任何一个类都有getClass()
方法,调用该方法即可获得一个表示类信息的对象Class
。getName
就是.
package com.tianmaying;
public class ReflectionTest {
public static void main(String[] args) throws Exception {
ReflectionTest reflectionTest = new ReflectionTest();
System.out.println(reflectionTest.getClass().getName());
}
}