Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 636 Bytes

README.md

File metadata and controls

29 lines (23 loc) · 636 Bytes

目次 前の問題 次の問題


025:オーバーライド(2)

  • 次のプログラムをコンパイル・実行するとどうなるか?(実際に実行させずに解答すること)
public class Knock025A {
    public static void main(String[] arguments) {
        Knock025A ab = new Knock025B();
        System.out.println(ab.getValue());
    }
    
    private int getValue() {
        return 1;
    }
}
public class Knock025B extends Knock025A {
    private int getValue() {
        return 2;
    }
}