package org.my.java;
public class TestTypeVariable {
static <T,A extends T> void typeVarType(T t, A a){
System.out.println(a.getClass());
System.out.println(t.getClass());
}
public static void main(String[] s){
int i= 1;
typeVarType("string", i);
}
}
when run, following is the output :
class java.lang.Integer
class java.lang.String
How can A
be of type Integer
when it has been already upper-bounded to String
?
Please explain me on it.
T
toObject
andA
toInteger
, there is no issue. – Zinnia