单选题Click the Exhibit button.   Given: ClassA a = new ClassA();   a.methodA();   What is the result?()AThe code runs with no output.BCompilation fails.CAn exception is thrown at runtime.DClassC is displayed.

题目
单选题
Click the Exhibit button.   Given: ClassA a = new ClassA();   a.methodA();   What is the result?()
A

 The code runs with no output.

B

 Compilation fails.

C

 An exception is thrown at runtime.

D

 ClassC is displayed.


相似考题
更多“单选题Click the Exhibit button.   Given: ClassA a = new ClassA();   a.methodA();   What is the result?()A  The code runs with no output.B  Compilation fails.C  An exception is thrown at runtime.D  ClassC is displayed.”相关问题
  • 第1题:

    Given: class ClassA {} class ClassB extends ClassA {} class ClassC extends ClassA {} and: ClassA p0 = new ClassA(); ClassB p1 = new ClassB(); ClassC p2 = new ClassC(); ClassA p3 = new ClassB(); ClassA p4 = new ClassC(); Which three are valid?()

    • A、p0 = p1;
    • B、p1 = p2;
    • C、p2 = p4;
    • D、p2 = (ClassC)p1;
    • E、p1 = (ClassB)p3;
    • F、p2 = (ClassC)p4;

    正确答案:A,E,F

  • 第2题:

    10. public class ClassA {  11. public void methodA() {  12. ClassB classB = new ClassB();  13. classB.getValue();  14. }  15. }  And:  20. class ClassB {  21. public ClassC classC;  22.  23. public String getValue() {  24. return classC.getValue();  25. }  26. }  And:  30. class ClassC {  31. public String value;  32.  33. public String getValue() {  34. value = “ClassB”;  35. return value;  36. }  37. }  Given:  ClassA a = new ClassA();  a.methodA();  What is the result?()

    • A、 Compilation fails.
    • B、 ClassC is displayed.
    • C、 The code runs with no output.
    • D、 An exception is thrown at runtime.

    正确答案:D

  • 第3题:

    public class ClassA {  public int getValue() {  int value=0;  boolean setting = true;  String title=”Hello”;  (value || (setting && title == “Hello”)) { return 1; }  (value == 1 & title.equals(”Hello”)) { return 2; }  }  } And:  ClassA a = new ClassA();  a.getValue();  What is the result?() 

    • A、 1
    • B、 2
    • C、 Compilation fails.
    • D、 The code runs with no output.
    • E、 An exception is thrown at runtime.

    正确答案:C

  • 第4题:

    单选题
    11. static classA {  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.A a=new B();  19. a.process();  20.}  What is the result?()
    A

     B

    B

     The code runs with no output.

    C

     An exception is thrown at runtime.

    D

     Compilation fails because of an error in line 15.

    E

     Compilation fails because of an error in line 18.

    F

     Compilation fails because of an error in line 19.


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

  • 第5题:

    单选题
    Given: 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.


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

  • 第6题:

    单选题
    Click the Exhibit button. Given: ClassA a = new ClassA( ); a.methodA( ); What is the result? ()
    A

    Compilation fails.

    B

    ClassC is displayed.

    C

    The code runs with no output.

    D

    An exception is thrown at runtime.


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

  • 第7题:

    单选题
    Click the Exhibit button.   Given: ClassA a = new ClassA();   a.methodA();   What is the result?()
    A

     The code runs with no output.

    B

     Compilation fails.

    C

     An exception is thrown at runtime.

    D

     ClassC is displayed.


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

  • 第8题:

    多选题
    Given: class ClassA {} class ClassB extends ClassA {} class ClassC extends ClassA {} and: ClassA p0 = new ClassA(); ClassB p1 = new ClassB(); ClassC p2 = new ClassC(); ClassA p3 = new ClassB(); ClassA p4 = new ClassC(); Which three are valid?()
    A

    p0 = p1;

    B

    p1 = p2;

    C

    p2 = p4;

    D

    p2 = (ClassC)p1;

    E

    p1 = (ClassB)p3;

    F

    p2 = (ClassC)p4;


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

  • 第9题:

    单选题
    10. public class ClassA {  11. public void methodA() {  12. ClassB classB = new ClassB();  13. classB.getValue();  14. }  15. }  And:  20. class ClassB {  21. public ClassC classC;  22.  23. public String getValue() {  24. return classC.getValue();  25. }  26. }  And:  30. class ClassC {  31. public String value;  32.  33. public String getValue() {  34. value = “ClassB”;  35. return value;  36. }  37. }  Given:  ClassA a = new ClassA();  a.methodA();  What is the result?()
    A

     Compilation fails.

    B

     ClassC is displayed.

    C

     The code runs with no output.

    D

     An exception is thrown at runtime.


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

  • 第10题:

    单选题
    Given: What is the result?()
    A

    test end

    B

    Compilation fails.

    C

    test runtime end

    D

    test exception end

    E

    A Throwable is thrown by main at runtime.


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

  • 第11题:

    单选题
    public class ClassA{ public int getValue(){ int value=0; boolean setting=true; String title="Hello"; if(value||(setting && title=="Hello")){return 1;} if(value==1&title.equals("Hello")){return 2;} } } And: ClassA a=new ClassA(); a.getValue(); What is the result?()
    A

    1

    B

    2

    C

    Compilation fails.

    D

    The code runs with no output.

    E

    An exception is thrown at runtime.


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

  • 第12题:

    单选题
    public class ClassA {  public int getValue() {  int value=0;  boolean setting = true;  String title=”Hello”;  (value || (setting && title == “Hello”)) { return 1; }  (value == 1 & title.equals(”Hello”)) { return 2; }  }  } And:  ClassA a = new ClassA();  a.getValue();  What is the result?()
    A

     1

    B

     2

    C

     Compilation fails.

    D

     The code runs with no output.

    E

     An exception is thrown at runtime.


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

  • 第13题:

    public class Foo {  public static void main(String[] args) {  try {  return;  } finally {  System.out.println( “Finally” );  }  }  }  What is the result?()

    • A、 Finally
    • B、 Compilation fails.
    • C、 The code runs with no output.
    • D、 An exception is thrown at runtime.

    正确答案:A

  • 第14题:

    interface Beta {}  class Alpha implements Beta {  String testIt() {  return “Tested”;  }  }  public class Main1 {  static Beta getIt() {  return new Alpha();  }  public static void main( String[] args ) {  Beta b = getIt();  System.out.println( b.testIt() );  }  }  What is the result?()  

    • A、 Tested
    • B、 Compilation fails.
    • C、 The code runs with no output.
    • D、 An exception is thrown at runtime.

    正确答案:B

  • 第15题:

    11. static classA {  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.A a=new B();  19. a.process();  20.}  What is the result?() 

    • A、 B
    • B、 The code runs with no output.
    • C、 An exception is thrown at runtime.
    • D、 Compilation fails because of an error in line 15.
    • E、 Compilation fails because of an error in line 18.
    • F、 Compilation fails because of an error in line 19.

    正确答案:F

  • 第16题:

    单选题
    Given: What is the result?()
    A

    Compilation fails.

    B

    An exception is thrown at runtime.

    C

    The code executes normally and prints "sleep".

    D

    The code executes normally, but nothing is printed.


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

  • 第17题:

    单选题
    Click the Exhibit button.   What is the result?()
    A

     The code will deadlock.

    B

     The code may run with output "2 0 6 4".

    C

     The code may run with no output.

    D

     The code may run with output "0 6".

    E

     An exception is thrown at runtime.

    F

     The code may run with output "0 2 4 6".


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

  • 第18题:

    单选题
    Given: What is the result?()
    A

    Compilation fails.

    B

    An exception is thrown at runtime.

    C

    The code executes and prints "running".

    D

    The code executes and prints "runningrunning".

    E

    The code executes and prints "runningrunningrunning".


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

  • 第19题:

    单选题
    Click the Exhibit button. What is the result?()
    A

    Line 26 prints "a" to System.out.

    B

    Line 26 prints "b" to System.out.

    C

    An exception is thrown at line 26 at runtime.

    D

    Compilation of class A will fail due to an error in line 6.


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

  • 第20题:

    单选题
    public class Foo {  public static void main(String[] args) {  try {  return;  } finally {  System.out.println( “Finally” );  }  }  }  What is the result?()
    A

     Finally

    B

     Compilation fails.

    C

     The code runs with no output.

    D

     An exception is thrown at runtime.


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

  • 第21题:

    单选题
    Click the Exhibit button. What is the result?()
    A

    Value is: 8

    B

    Compilation fails.

    C

    Value is: 12

    D

    Value is: -12


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

  • 第22题:

    单选题
    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.


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

  • 第23题:

    单选题
    Given: What is the result?()
    A

    The code runs with no output.

    B

    An exception is thrown at runtime.

    C

    Compilation fails because of an error in line 20.

    D

    Compilation fails because of an error in line 21.

    E

    Compilation fails because of an error in line 23.

    F

    Compilation fails because of an error in line 25.


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

  • 第24题:

    单选题
    Given: 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.


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