public int i = 0; public void test(){ System.out.println(this.getClass().getName()); System.out.println(this.i); } public static void main(String[] args){ Test a = new B(); a.test(); B b1=new B(); b1.out(); } } class B extends Test{ //子类 public int i =1; public void out(){ System.out.println(this.i); System.out.println(super.i); } }
public class Test{
public int i = 0;
public void test(){
System.out.println(this.getClass().getName());
System.out.println(this.i);
}
public static void main(String[] args){
Test a = new B();
a.test();
B b1=new B();
b1.out();
}
} class B extends Test{ //子类 public int i =1;
public void out(){
System.out.println(this.i);
System.out.println(super.i);
}
}