日期:2014-05-19  浏览次数:20639 次

class.formName获取的类能做List的泛型类么?
我的javabean类名:com.BBM.bean.student
我通过传进来一个字符串类名来获得javabean类来做List的泛型
List<(Class.forName("com.BBM.bean.student").newInstance().getClass())> list =null;
但是上面的代码List报错:list cannot be resolved to a variable
这个求大神帮忙看看啊!
------解决方案--------------------
引用:
引用:引用:引用:Object obj = Class.forName("com.BBM.bean.student").newInstance().getClass()

obj是一个runtime class of this Obje……
你想获取哪个类就传那个类进去就可以了。