阅读背景:

『阿男的Java泛型讲座』*02*Type Reification

来源:互联网 

本节课视频

『阿男的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




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: