单选题Given: What is the result when method testIfA is invoked?()A TrueB Not trueC An exception is thrown at runtime.D Compilation fails because of an error at line 12.E Compilation fails because of an error at line 19.

题目
单选题
Given: What is the result when method testIfA is invoked?()
A

True

B

Not true

C

An exception is thrown at runtime.

D

Compilation fails because of an error at line 12.

E

Compilation fails because of an error at line 19.

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Given:What is the result when method testIfA is invoked?()

A.True

B.Not true

C.An exception is thrown at runtime.

D.Compilation fails because of an error at line 12.

E.Compilation fails because of an error at line 19.


参考答案:A

第2题:

11. public void testIfA() {  12. if(testIfB(”True”)) {  13. System.out.println(”True”);  14. } else {  15. System.out.println(”Not true”);  16. }  17. }  18. public Boolean testIfB(String str) {  19. return Boolean.valueOf(str);  20. }  What is the result when method testIfA is invoked?() 

  • A、 True
  • B、 Not true
  • C、 An exception is thrown at runtime.
  • D、 Compilation fails because of an error at line 12.
  • E、 Compilation fails because of an error at line 19.

正确答案:A

第3题:

public static void main(String[]args){12.Object obj=new int[]{1,2,3};13.int[] someArray=(int[])obj;14.for(inti:someArray)System.out.print(i+"")15.}What is the result?()

A.123

B.Compilation fails because of an error in line 12.

C.Compilation fails because of an error in line 13.

D.Compilation fails because of an error in line 14.

E.A ClassCastException is thrown at runtime.


参考答案:A

第4题:

class A {  public byte getNumber() {  return 1;  }  }  class B extends A {  public short getNumber() {  return 2;  }  public static void main(String args[]) {  B b = new B();  System.out.println(b.getNumber()); }  }   What is the result?()

  • A、 1
  • B、 2
  • C、 An exception is thrown at runtime.
  • D、 Compilation fails because of an error in line 8.
  • E、 Compilation fails because of an error in line 14.

正确答案:D

第5题:

11. static class A {  12. void process() throws Exception { throw new Exception(); }  13. }  14. static class B extends A {  15. void process() { System.out.println(”B”); }  16. }  17. public static void main(String[] args) {  18. new B().process();  19. }  What is the result?() 

  • A、 B
  • B、 The code runs with no output.
  • C、 Compilation fails because of an error in line 12.
  • D、 Compilation fails because of an error in line 15.
  • E、 Compilation fails because of an error in line 18.

正确答案:A

第6题:

11. public static void main(String[] args) {  12. Integer i = uew Integer(1) + new Integer(2);  13. switch(i) {  14. case 3: System.out.println(”three”); break;  15. default: System.out.println(”other”); break;  16. }  17. }  What is the result?() 

  • A、 three
  • B、 other
  • C、 An exception is thrown at runtime.
  • D、 Compilation fails because of an error on line 12.
  • E、 Compilation fails because of an error on line 13.
  • F、 Compilation fails because of an error on line 15.

正确答案:A

第7题:

11. public static void main(String[] args) {  12. Object obj = new Object() {  13. public int hashCode() {  14. returns 42; 15. }  16. };  17. System.out.println(obj.hashCode());  18. }    What is the result? () 

  • A、 42
  • B、 An exception is thrown at runtime.
  • C、 Compilation fails because of an error on line 12.
  • D、 Compilation fails because of an error on line 16.
  • E、 Compilation fails because of an error on line 17.

正确答案:A

第8题:

Given:What is the result when the programmer attempts to compile the code and run it with the command java Converter 12?()

A. It is true that j==i.

B. It is false that j==i.

C. An exception is thrown at runtime.

D. Compilation fails because of an error in line 13.


参考答案:D

第9题:

package foo;  import java.util.Vector; private class MyVector extends Vector {  int i = 1;  public MyVector() {  i = 2; } }  public class MyNewVector extends MyVector {  public MyNewVector() {  i = 4;  }  public static void main(String args[]) {  MyVector v = new MyNewVector();  }  }  What is the result?()

  • A、 Compilation succeeds.
  • B、 Compilation fails because of an error at line 5.
  • C、 Compilation fails because of an error at line 6.
  • D、 Compilation fails because of an error at line 14.
  • E、 Compilation fails because of an error at line 17.

正确答案:B

第10题:

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、 test
  • B、 null
  • C、 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.

正确答案:A

更多相关问题