Class--2019-04-14

获取class对象,有三种方法:

1.通过类名.class直接访问

Class c = Integer.class;

2.通过Class.forName(类名)函数获取

Class c = Class.forName("Integer");

 

3.通过对象.class获取

Integer n = new Integer ();

Class c = n.getClass();

 

 

posted @ 2019-04-14 19:41  风中灵叶  阅读(96)  评论(0编辑  收藏  举报