本节课视频
『阿男的Java泛型讲座』*02*Type Reification
本节课代码
import java.lang.reflect.Method;
/**
* Created by weli on 4/15/16.
*/
public class Reification {
public static <E> E foo() {
return null;
}
public static void main(String[] args) throws Exception {
Method fooMethod = Reification.class.getMethod("foo", null);
System.out.println(fooMethod);
System.out.println(fooMethod.getReturnType()); // reified type
System.out.println(fooMethod.getGenericReturnType());
System.out.println(fooMethod.getGenericReturnType().getClass());
}
}
imp