y.java

来自「程序练习中包括书中实例程序代码和练习中要用到的代码,是压缩文件」· Java 代码 · 共 24 行

JAVA
24
字号
class X {
   public X() {
      System.out.println( "Constructing X" );
      f();
   }
   protected void f() {
      System.out.println( "X.f()" );
   }
   protected void g() {
      System.out.println( "X.g()" );
   }
}
public class Y extends X {
   public Y() {
      System.out.println( "Constructing Y" );
      f();
   }
   protected void f() {
      System.out.println( "Y.f()" );
   }
   public static void main( String[] args ) {
      new Y();
   }
}

⌨️ 快捷键说明

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