此题为判断题(对,错)。
第1题:
编译以下代码,将出现什么情况?()
abstract class Shape
{ abstract void draw();}
Class Square extends Shape{ }
A. Square类和Shape类都可以成功编译
B. Square类无法编译,但Shape类可以编译
C. 类无法编译,但Square类可以编译
D. Square类和Shape类都无法编译
第2题:
此题为判断题(对,错)。
第3题:
此题为判断题(对,错)。
第4题:
此题为判断题(对,错)。
第5题:
此题为判断题(对,错)。
第6题:
此题为判断题(对,错)。
第7题:
此题为判断题(对,错)。
第8题:
此题为判断题(对,错)。
第9题:
此题为判断题(对,错)。
第10题:
现有: interface I { void go(); } abstract class A implements I { } class C extends A { void go(){ } } 结果是什么?()
第11题:
现有: 1. interface Animal { 2. void eat(); 3. } 4. 5. // insert code here 6. 7. public class HouseCat extends Feline { 8. public void eat() { } 9. } 和五个声明: abstract class Feline implements Animal { } abstract class Feline implements Animal { void eat(); } abstract class Feline implements Animal { public void eat(); } abstract class Feline implements Animal { public void eat() { } } abstract class Feline implements Animal { abstract public void eat(); } 分别插入到第5行,有几个可以通过编译?()
第12题:
代码通过编译
由于第1行的错误导致编译失败
由于笫3行的错误导致编译失败
由于第6行的错误导致编译失败
第13题:
以下程序的编译和运行结果为?
abstract class Base{
abstract public void myfunc();
public void another(){
System.out.println("Another method");
}
}
public class Abs extends Base{
public static void main(String argv[]){
Abs a = new Abs();
A.amethod();
}
public void myfunc(){
System.out.println("My Func");
}
public void amethod(){
myfunc();
}
}
A.输出结果为 My Func
B.编译指示 Base 类中无抽象方法
C.编译通过,但运行时指示Base 类中无抽象方法
D.编译指示Base 类中的myfunc方法无方法体,没谁会喜欢该方法。
第14题:
此题为判断题(对,错)。
第15题:
此题为判断题(对,错)。
第16题:
此题为判断题(对,错)。
第17题:
设有程序如下: abstract class absclass { abstract void method1(); } class conclass extends absclass { public void method1() { System.out.println("子类");} } public class mainclass { public static void main(String args[]) { absclass ac1=new absclass(); //语句1 absclass ac2=new conclass(); //语句2 ac2.method1(); //语句3 } } 则main()方法中的第一条语句(即语句1)可以顺利通过编译。()
此题为判断题(对,错)。
第18题:
此题为判断题(对,错)。
第19题:
此题为判断题(对,错)。
第20题:
此题为判断题(对,错)。
第21题:
在Java语言中,如果你有下面的类定义: Abstract class Shape{ Abstract void draw(); } class Square extendeds Shape{} 如果你试图编译上面的代码会发生()。
第22题:
现有: interface Animal { void eat () ; } //insert code here public class HouseCat extends Feline { public void eat() { } } 和五个申明 abstract class Feline implements Animal { } abstract class Feline implements Animal { void eat () ; } abstract class Feline implements Animal { public void eat();} abstract class Feline implements Animal { public void eat() {} } abstract class Feline implements Animal { abstract public void eat();} 结果为:()
第23题:
public abstract class Shape { private int x; private int y; public abstract void draw(); public void setAnchor(int x, int y) { this.x = x; this.y = y; } } Which two classes use the Shape class correctly?()