10. public class&ensp

题目

10. public class Hello {  11. String title;  12. int value;  13. public Hello() {  14. title += “ World”;  15. }  16. public Hello(int value) {  17. this.value = value;  18. title = “Hello”;  19. Hello();  20. }  21. }  and:  30. Hello c = new Hello(5);  31. System.out.println(c.title);  What is the result?() 

  • A、 Hello
  • B、 Hello World
  • C、 Compilation fails.
  • D、 Hello World 5
  • E、 The code runs with no output.
  • F、 An exception is thrown at runtime.
参考答案和解析
正确答案:C
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

10. public class ClassA {  11. public void count(int i) {  12. count(++i);  13. }  14. }  And:  20. ClassA a = new ClassA();  21. a.count(3);  Which exception or error should be thrown by the virtual machine?() 

  • A、 StackOverflowError
  • B、 NullPointerException
  • C、 NumberFormatException
  • D、 IllegalArgumentException
  • E、 ExceptionlnlnitializerError

正确答案:A

第2题:

1. public class A {  2. public void doit() {  3. }  4. public String doit() {  5. return “a”;  6. }  7. public double doit(int x) {  8. return 1.0;  9. }  10.}  What is the result?() 

  • A、 An exception is thrown at runtime.
  • B、 Compilation fails because of an error in line 7.
  • C、 Compilation fails because of an error in line 4.
  • D、 Compilation succeeds and no runtime errors with class A occur.

正确答案:C

第3题:

IP地址 10. 10.13.15/24表示该主机所在网络的网络号为()。

A. 10. 10. 13.0

B. 10. 10. 0.0

C. 10. 13.15

D. 10. 0. 0.0


参考答案:A

第4题:

多选题
Given: 10. interface Jumper { public void jump(); } ...   20. class Animal {} ...   30. class Dog extends Animal {   31. Tail tail;   32. }   ...   40. class Beagle extends Dog implements Jumper{   41. public void jump() {}  42. }   ...   50. class Cat implements Jumper{   51. public void jump() {}   52. }. Which three are true?()
A

Cat is-a Jumper

B

Cat is-a Animal

C

Dog is-a Jumper

D

Dog is-a Animal

E

Beagle has-a Jumper

F

Cat has-a Animal

G

Beagle has-a Tail


正确答案: E,B
解析: 暂无解析

第5题:

1. public class X {  2. public object m ()  {  3. object o = new float (3.14F);  4. object [] oa = new object [1]; 5. oa[0]= o;  6. o = null;  7. oa[0] = null;  10. return o;  9. }  10. }  When is the float object created in line 3, eligible for garbage collection?()  

  • A、 Just after line 5.
  • B、 Just after line 6.
  • C、 Just after line 7.
  • D、 Just after line 8(that is, as the method returns).

正确答案:C

第6题:

1. public class Outer{  2. public void someOuterMethod() {  3. // Line 3  4. }  5. public class Inner{}  6. public static void main( String[]argv ) {  7. Outer o = new Outer();  8. // Line 8  9. }  10. }  Which instantiates an instance of Inner?()  

  • A、 new Inner(); // At line 3
  • B、 new Inner(); // At line 8
  • C、 new o.Inner(); // At line 8
  • D、 new Outer.Inner(); // At line 8

正确答案:A

第7题:

1. public class X {  2. public static void main (String[]args)   {  3. int [] a = new int [1]  4. modify(a);  5. System.out.printIn(a[0]);  6. }  7.    8. public static void modify (int[] a)  {  9.   a[0] ++;  10.    } 11. }       What is the result?()

  • A、 The program runs and prints “0”
  • B、 The program runs and prints “1”
  • C、 The program runs but aborts with an exception.
  • D、 An error “possible undefined variable” at line 4 causes compilation to fail.
  • E、 An error “possible undefined variable” at line 9 causes compilation to fail.

正确答案:B

第8题:

Given:10. interface Data { public void load(); }11. abstract class Info { public abstract void load(); }Which class correctly uses the Data interface and Info class?()()

A.

B.

C.

D.

E.

F.


参考答案:A

第9题:

单选题
1. public class X {  2. public object m ()  {  3. object o = new float (3.14F);  4. object [] oa = new object [1]; 5. oa[0]= o;  6. o = null;  7. oa[0] = null;  10. return o;  9. }  10. }  When is the float object created in line 3, eligible for garbage collection?()
A

 Just after line 5.

B

 Just after line 6.

C

 Just after line 7.

D

 Just after line 8(that is, as the method returns).


正确答案: D
解析: 暂无解析

第10题:

单选题
1. public class A {  2. public void doit() {  3. }  4. public String doit() {  5. return “a”;  6. }  7. public double doit(int x) {  8. return 1.0;  9. }  10.}  What is the result?()
A

 An exception is thrown at runtime.

B

 Compilation fails because of an error in line 7.

C

 Compilation fails because of an error in line 4.

D

 Compilation succeeds and no runtime errors with class A occur.


正确答案: C
解析: 暂无解析

更多相关问题