inher14.java

来自「该原代码为<Java编程基础、应用与实例>的附盘代码」· Java 代码 · 共 28 行

JAVA
28
字号
class A{
  int a=1;
  A(){
  	System.out.println("A努贰胶 积己磊 角青");
  }	
}
class B extends A{
  int b=2;
  B(){
  	System.out.println("B努贰胶 积己磊 角青");
  }	
}
class C extends B{
  int c=3;
  
  C(){
  	System.out.println("C努贰胶 积己磊 角青");
  }
}
public class Inher14{
  public static void main(String[] args){
    C ob=new C();
    System.out.println(ob.a);
    System.out.println(ob.b);
    System.out.println(ob.c);
    System.out.println(ob.toString());
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?