网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
1. interface Animal { 2. void eat(); 3. } 4. 5. // insert code here 6. 7. public class HouseCat implements Feline { 8. public void eat() { } 9. } 和以下三个接口声明: interface Feline extends Animal { } interface Feline extends Animal { void eat(); } interface Feline extends Animal { void eat() { } } 分别插入到第 5 行,有多少行可以编译?()
A
0
B
1
C
2
D
3
参考答案
参考解析
解析:
暂无解析
更多 “单选题1. interface Animal { 2. void eat(); 3. } 4. 5. // insert code here 6. 7. public class HouseCat implements Feline { 8. public void eat() { } 9. } 和以下三个接口声明: interface Feline extends Animal { } interface Feline extends Animal { void eat(); } interface Feline extends Animal { void eat() { } } 分别插入到第 5 行,有多少行可以编译?()A 0B 1C 2D 3” 相关考题
考题
1. public class Target { 2. private int i = 0; 3. public int addOne() { 4. return ++i; 5. } 6. } And: 1. public class Client { 2. public static void main(String[] args) { 3. System.out.println(new Target().addOne()); 4. } 5. } Which change can you make to Target without affecting Client?() A、 Line 4 of class Target can be changed to return i++;B、 Line 2 of class Target can be changed to private int i = 1;C、 Line 3 of class Target can be changed to private int addOne() {D、 Line 2 of class Target can be changed to private Integer i = 0;
考题
1. public interface A { 2. public void doSomething(String thing); 3. } 1. public class AImpl implements A { 2. public void doSomething(String msg) { } 3. } 1. public class B { 2. public A doit() { 3. // more code here 4. } 5. 6. public String execute() { 7. // more code here 8. } 9. } 1. public class C extends B { 2. public AImpl doit() { 3. // more code here 4. } 5. 6. public Object execute() { 7. // more code here 8. } 9. } Which statement is true about the classes and interfaces in the exhibit?() A、 Compilation will succeed for all classes and interfaces.B、 Compilation of class C will fail because of an error in line 2.C、 Compilation of class C will fail because of an error in line 6.D、 Compilation of class AImpl will fail because of an error in line 2.
考题
1. public class Test { 2. public static void main (String args) { 3. unsigned byte b = 0; 4. b--; 5. 6. } 7. } What is the value of b at line 5?() A、 -1B、 255C、 127D、 Compilation will fail.E、 Compilation will succeed but the program will throw an exception at line 4.
考题
1. public class A { 2. void A() { 3. System.out.println(“Class A”); 4. } 5. public static void main(String[] args) { 6. new A(); 7. } 8. } What is the result?() A、 Class AB、 Compilation fails.C、 An exception is thrown at line 2.D、 An exception is thrown at line 6.E、 The code executes with no output.
考题
常见的网上购物流程是()。A、1.查找商品2.提交订单3.放入购物车4.查看订单状态5.收货确认B、1.查找商品2.提交订单3.查看订单状态4.放入购物车5.收货确认C、1.查找商品2.放入购物车3.提交订单4.查看订单状态5.收货确认D、1.查找商品2.放入购物车3.提交订单4.收货确认5.查看订单状态
考题
1. public class test ( 2. public static void main(string args[]) { 3. int 1= 0; 4. while (i) { 5. if (i==4) { 6. break; 7. } 8. ++i; 9. } 10. 11. } 12. ) What is the value of i at line 10?()A、 0B、 3C、 4D、 5E、 The code will not compile.
考题
1. interface TestA { String toString(); } 2. public class Test { 3. public static void main(String[] args) { 4. System.out.println(new TestA() { 5. public String toString() { return “test”; } 6. } 7. } 8. } What is the result?() A、 testB、 nullC、 An exception is thrown at runtime.D、 Compilation fails because of an error in line 1.E、 Compilation fails because of an error in line 4.F、 Compilation fails because of an error in line 5.
考题
单选题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行的错误导致编译失败
考题
多选题现有2 个文件: 1. package x; 2. public class X { 3. public static void doX() { System.out.print("doX "); } 4. } 和: 1. class Find { 2. public static void main(String [] args) { 3. //insert code here 4. } 5. } 哪两行分别插入到类Find 的第3 行将编译并产生输出“doX”? ()AdoX();BX.doX();Cx.X.doX();Dx.X myX = new x.X(); myX.doX();
考题
单选题1. interface foo { 2. int k = 0; 3. } 4. 5. public class test implements Foo ( 6. public static void main(String args[]) ( 7. int i; 8. Test test = new test (); 9. i= test.k; 10.i= Test.k; 11.i= Foo.k; 12.) 13.) 14. What is the result?()A
Compilation succeeds.B
An error at line 2 causes compilation to fail.C
An error at line 9 causes compilation to fail.D
An error at line 10 causes compilation to fail.E
An error at line 11 causes compilation to fail.
考题
单选题1. public class SimpleCalc { 2. public int value; 3. public void calculate() { value += 7; } 4. } And: 1. public class MultiCalc extends SimpleCalc { 2. public void calculate() { value -= 3; } 3. public void calculate(int multiplier) { 4. calculate(); 5. super.calculate(); 6. value *=multiplier; 7. } 8. public static void main(String[] args) { 9. MultiCalc calculator = new MultiCalc(); 10. calculator.calculate(2); 11. System.out.println(”Value is: “+ calculator.value); 12. } 13. } What is the result?()A
Value is: 8B
Compilation fails.C
Value is: 12D
Value is: -12E
The code runs with no output.F
An exception is thrown at runtime.
考题
单选题现有: 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行,有几个可以通过编译?()A
0B
1C
2D
3
考题
单选题1. public class test ( 2. public static void main(string args[]) { 3. int 1= 0; 4. while (i) { 5. if (i==4) { 6. break; 7. } 8. ++i; 9. } 10. 11. } 12. ) What is the value of i at line 10?()A
0B
3C
4D
5E
The code will not compile.
考题
多选题1. public class A { 2. public void method1() { 3. B b=new B(); 4. b.method2(); 5. // more code here 6. } 7. } 1. public class B { 2. public void method2() { 3.C c=new C(); 4. c.method3(); 5. // more code here 6. } 7. } 1. public class C { 2. public void method3() { 3. // more code here 4. } 5. } Given: 25. try { 26. A a=new A(); 27. a.method1(); 28. } catch (Exception e) { 29. System.out.print(”an error occurred”); 30. } Which two are true if a NullPointerException is thrown on line 3 of class C?()AThe application will crash.BThe code on line 29 will be executed.CThe code on line 5 of class A will execute.DThe code on line 5 of class B will execute.EThe exception will be propagated back to line 27.
考题
单选题1. public class A { 2. void A() { 3. System.out.println(“Class A”); 4. } 5. public static void main(String[] args) { 6. new A(); 7. } 8. } What is the result?()A
Class AB
Compilation fails.C
An exception is thrown at line 2.D
An exception is thrown at line 6.E
The code executes with no output.
考题
单选题现有: 1. interface Animal f 2. void eat(); 3. } 4. 5. // insert code here 6. 7. public class HouseCat implements Feline { 8. public void eat() { } 9. } 和以下三个接口声明: interface Feline extends Animal ( ) interface Feline extends Animal {void eat(); } interface Feline extends Animal {void eat() { } } 分别插入到第5行,有多少行可以编译?A
0B
1C
2D
3
考题
单选题现有: 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();} 结果为:()A
1B
2C
3D
4
考题
单选题1. interface Animal { 2. void eat(); 3. } 4. 5. // insert code here 6. 7. public class HouseCat implements Feline { 8. public void eat() { } 9. } 和以下三个接口声明: interface Feline extends Animal { } interface Feline extends Animal { void eat(); } interface Feline extends Animal { void eat() { } } 分别插入到第 5 行,有多少行可以编译?()A
0B
1C
2D
3
考题
单选题1. class Animal { Animal getOne() { return new Animal(); } } 2. class Dog extends Animal { 3. // insert code here 4. } 5. 6. class AnimalTest { 7. public static void main(String [] args) { 8. Animal [] animal = { new Animal(), new Dog() } ; 9. for( Animal a : animal) { 10. Animal x = a.getOne(); 11. } 12. } 13. } 和代码: 3a. Dog getOne() { return new Dog(); } 3b. Animal getOne() { return new Dog(); } 第 3 行中插入的哪项将编译且运行无异常?()A
3a行B
3b行C
3a行或3b行D
既非3a,也非3b
考题
填空题露地观赏植物可分1.()2.()3.()4.()5.().
热门标签
最新试卷