package demo2;
public class Base {
public int a = 1;
public int b = 2;
}
package demo2;
public class Derived extends Base{
public int c = 3;
public int a = 100;
//子类当中 如何访问父类的成员
public void func() {
System.out.println("父类的a: "+super.a);
System.out.println(this.a);
System.out.println(this.b);
System.out.println("父类的b: "+super.b);
Base base = new Base();
System.out.println(base.b);
System.out.println(this.c);
}
}
package demo2;
public class Test {
public static void main(String[] args) {
Derived derievd = new Derived();
derievd.func();
}
}