相关考题
-
单项选择题
1. interface I { void go(); } 2. 3. abstract class A implements I { } 4. 5. class C extends A { 6. void go(){ } 7. } 结果是什么?()
A.代码通过编译
B.由于多个错误导致编译失败
C.由于第1行的错误导致编译失败
D.由于第6行的错误导致编译失败 -
单项选择题
抽象方法可以包含在任何类中()
A.接口中只能包含抽象方法和常量
B.一个类可以实现多个接口
C.接口不能被继承
D.类实现接口时必须实现其中的方法 -
单项选择题
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(); } } 结果为:()
A.bits bits
B.bits more
C.more more
D.编译失败
