publicclassDemo{privateClass clazz;publicTgetDemo()throwsInstantiationException, IllegalAccessException{returnclazz.newInstance(); }publicstaticvoidtest()throwsInstantiationException, IllegalAccessException{ String str =newDemo().getDemo(); } }
TypesuperClass = getClass().getGenericSuperclass();Typetype= ((ParameterizedType) superClass).getActualTypeArguments()[0];
网友评论