sun201200204 发表于 2013-1-27 05:08:38

java面试题

  1. class A {  2. protected int method1(int a, int b) { return 0; }  3. }  Which two are valid in a class that extends class A? (Choose two)  A. public int method1(int a, int b) { return 0; }  B. private int method1(int a, int b) { return 0; }  C. private int method1(int a, long b) { return 0; }  D. public short method1(int a, int b) { return 0; }  E. static protected int method1(int a, int b) { return 0; } 答案:A,C
B:Cannot reduce the visibility of the inherited method from A
D:Multiple markers at this line
    - The return type is incompatible with
     A.method1(int, int)
E:This static method cannot hide the instance method from A
页: [1]
查看完整版本: java面试题