A. class語句 B. new語句 C. package語句 D. 訪問修飾符
現(xiàn)有: 1. class HorseRadish { 2. // insert code here 3. protected HorseRadish(int x) { 4. System.out.println("bok choy"); 5. } 6. } 7. class Wasabi extends HorseRadish { 8. public static void main(String [] args) { 9. Wasabi w = new Wasabi(); 10. } 11. } 分別插入到第 2 行,哪兩項(xiàng)允許代碼編譯并產(chǎn)生"bok choy" 輸出結(jié)果?()
A. // just a comment B. protected HorseRadish() { } C. protected HorseRadish() { this(42);} D. protected HorseRadish() { new HorseRadish (42);}
現(xiàn)有: 1. class Synapse { 2. protected int gap() { return 7; } 3. } 4. 5. class Creb extends Synapse { 6. // insert code here 7. } 分別插入到第 6 行,哪三行可以編譯?()
A. int gap() { return 7; } B. public int gap() { return 7; } C. private int gap(int x) { return 7; } D. protected Creb gap() { return this; } E. public int gap() { return Integer.getInteger ("42"); }