2013年6月9日

java 中如何遍历一个类的所有对象? 包括属性成员和函数成员

摘要: 摘自:http://zhidao.baidu.com/question/202202923.html 1 Class c = Class.forName("AbstractClassTest.Car"); //要包名+类名 2 Object o = c.newInstance(); 3 Car car = (Car)o; 4 Field[] fields = c.getDeclaredFields();//拿到数据成员 5 Method[] methods = c.getMethods();//拿到函数成员 6 /*System.out.prin... 阅读全文

posted @ 2013-06-09 13:56 Livon 阅读(2870) 评论(0) 推荐(0)

导航