public static <T> T foo(T x, T x2) {
return (T) (x + " " + x2);
}
public static void main(String args[]) {
System.out.println(foo(33, "232"));
}
I know T gets to be of the type that is passed in the parameter. But here there are two types. Which one of them is T?
and why the compiler doesn't force me to have the parameters of same type when I call foo?