
public class GenericMethods {

    public static <T> void printArray(T[] inputArray) {
	for (T x : inputArray)
	    System.out.printf("%s ", x);
	System.out.println();
    }
     
    public static <T extends Comparable<T>> T maximum(T x, T y, T z) {
	T max = x;
	if (y.compareTo(max) > 0)
	    max = y;
	if (z.compareTo(max) > 0)
	    max = z;
	return max;
    }
    
    public static void main(String[] args) {
	Integer[] integerArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
	Double[] doubleArray = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 };
	
	printArray(integerArray);
	printArray(doubleArray);
	printArray(new String[]{"Ana", "Maria", "Pedro"});
	
	System.out.println(maximum(3, 4, 5));
	System.out.println(maximum("Ana", "Eduardo", "Beto"));
	
    }

}
