getClass()返回子类Class对象
getClass()返回子类Class对象
public class Test { static abstract class A{ int a; } static class B extends A{ int b; } public static void main(String[] args){ Test.A a = new Test.B(); //class Test$B System.out.println(a.getClass()); } }
输出:
class Test$B
这是水木竹水的博客