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; }
publicclass B extends A{
/**
//can not reduce the visibility of the inherited method from A
//即不能够使从类A中继续来的方法的可见性降低
//private int method1(int a, int b) { return 0; }
//This static method cannot hide the instance method from A
//静态方法不能够隐藏继承于A的实例
//static protected int method1(int a, int b) { return 0; }
//返回类型与A中的该方法不一致
//public short method1(int a, int b) { return 0; }