Using a tuple:
To make the return type of a method generic in Java, you can use a type parameter. A type parameter is a placeholder for a specific type that will be specified when the method is called.
There are a few ways you can return multiple values from a Java method: