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();

 

猜你喜欢

转载自www.cnblogs.com/fzly-88/p/10706594.html
今日推荐