A.抽象類中一定含有抽象方法 B.抽象類的聲明必須包含abstract關(guān)鍵字 C.抽象類既能被實(shí)例化也能被繼承 D.抽象類中不能有構(gòu)造方法
現(xiàn)有: class HorseRadish { //insert code here protected HorseRadish (int x) { System.out.println ("bok choy"); } } class Wasabi extends HorseRadish { public static void main (String [] args){ Wasabi w- new Wasabi(); } } 分別插入到第2行,哪兩項(xiàng)允許代碼編譯并產(chǎn)生”bok choy”輸出結(jié)果()
A. protected HorseRadish() {this (42);} B. protected HorseRadish() {} C. //just a comment D. protected HorseRadish() { new HorseRadish (42);}
現(xiàn)有: 1.class SuperFoo{ 2.SuperFoo doStuff (int x) { 3.return new SuperFoo(); 4. } 5. } 6. 7. class Foo extends SuperFoo { 8. //insert code here 9. } 和四個(gè)聲明: Foo doStuff (int x) { return new Foo(); } Foo doStuff (int x) { return new SuperFoo(); } SuperFoo doStuff(int x) { return new Foo(); } SuperFoo doStuff(int y) { return new SuperFoo(); } 分別插入到第8行,有幾個(gè)可以通過編澤?()
A. 1 B. 2 C. 3 D. 4