1. interface I { void go(); } 2. 3. abstract class A implements I { } 4. 5. class C extends A { 6. void go(){ } 7. } 結(jié)果是什么?()
A.代碼通過編譯 B.由于多個錯誤導(dǎo)致編譯失敗 C.由于第1行的錯誤導(dǎo)致編譯失敗 D.由于第6行的錯誤導(dǎo)致編譯失敗
A.接口中只能包含抽象方法和常量 B.一個類可以實現(xiàn)多個接口 C.接口不能被繼承 D.類實現(xiàn)接口時必須實現(xiàn)其中的方法
class BitStuff { BitStuff go() { System.out.print("bits "); return this; } } class MoreBits extends BitStuff { MoreBits go() { System.out.print("more "); return this; } public static void main(String [] args) { BitStuff [] bs = {new BitStuff(), new MoreBits()}; for( BitStuff b : bs) b.go(); } } 結(jié)果為:()
A.bits bits B.bits more C.more more D.編譯失敗