关键字super

class A{
 int x,y;
 A(){
  x=100;
  y=200;
  }
  A(int x,int y){
   this.x=x;
   this.y=y;
  }
}
class B extends A{
 int z;
 B(int x,int y){
  super(x,y);
  z=300;
 }
 B(){
  super();
  z=800;
 }
 public void f(){
  System.out.printf("x=%d,y=%d,z=%d\n",x,y,z);
 }
}
public class Example5_6{
 public static void main(String arg[]){
  B b1=new B(10,20);
  b1.f();
  B b2=new B();
  b2.f();
 }
}

原文地址:https://www.cnblogs.com/wangchunmeix/p/3020704.html