单选题Given:   What is the result?()AIf you define D e = new E(), then e.bMethod() invokes the version of bMethod() defined in Line 5.BIf you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 5.CCompilation fails be

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

 If you define D e = new E(), then e.bMethod() invokes the version of bMethod() defined in Line 5.

B

 If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 5.

C

 Compilation fails because of an error in line 9.

D

 If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.

E

 Compilation fails because of an error in line 3.

F

 Compilation fails because of an error in line 7.


相似考题
更多“单选题Given:   What is the result?()A  If you define D e = new E(), then e.bMethod() invokes the version of bMethod() defined in Line 5.B  If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 5.C  Compilation”相关问题
  • 第1题:

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

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

    正确答案:A

  • 第2题:

    A Windows Communication Foundation (WCF) service is self-hosted in a console application. The service implements the IDataAccess contract, which is defined in the MyApplication namespace. The service is implemented in a class named DataAccessService which implements the IDataAccess interface and also is defined in the MyApplication namespace. The hosting code is as follows. (Line numbers are included for reference only.) 01 static void Main(string[] args) 02 { 03 ServiceHost host; 04 ... 05 host.Open( ); 06 Console.ReadLine( ); 07 host.Close( ); 08 } You need to create a ServiceHost instance and assign it to the host variable. You also need to instantiate the service host.Which line of code should you insert at line 04?()

    • A、host = new ServiceHost("MyApplication.DataAccessService");
    • B、host = new ServiceHost("MyApplication.DataAccess");
    • C、host = new ServiceHost(typeof(IDataAccess));
    • D、host = new ServiceHost(typeof(DataAccessService));

    正确答案:D

  • 第3题:

    单选题
    1. interface A { public void aMethod(); }  2. interface B { public void bMethod(); }  3. interface C extends A,B { public void cMethod(); }  4. class D implements B {  5. public void bMethod() { }  6. }  7. class E extends D implements C {  8. public void aMethod() { }  9. public void bMethod() { }  10. public void cMethod() { }  11. }  What is the result?()
    A

     Compilation fails because of an error in line 3.

    B

     Compilation fails because of an error in line 7.

    C

     Compilation fails because of an error in line 9.

    D

     If you define D e = new E(), then e.bMethod() invokes the version of bMethod()defined in Line 5.

    E

     If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 5.

    F

     If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.


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

  • 第4题:

    单选题
    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
    解析: 暂无解析

  • 第5题:

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

    B

    B

    B, followed by an Exception.

    C

    Compilation fails due to an error on line 9.

    D

    Compilation fails due to an error on line 14.

    E

    An Exception is thrown with no other output.


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

  • 第6题:

    单选题
    Given:  Which code, inserted at line 15, creates an instance of the Point class defined in Line?()
    A

     Line l = new Line() ; l.Point p = new l.Point();

    B

     Line.Point p = new Line.Point();

    C

     The Point class cannot be instatiated at line 15.

    D

     Point p = new Point();


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

  • 第7题:

    单选题
    A Windows Communication Foundation (WCF) service is self-hosted in a console application. The service implements the IDataAccess contract, which is defined in the MyApplication namespace. The service is implemented in a class named DataAccessService which implements the IDataAccess interface and also is defined in the MyApplication namespace. The hosting code is as follows. (Line numbers are included for reference only.) 01 static void Main(string[] args) 02 { 03 ServiceHost host; 04 ... 05 host.Open( ); 06 Console.ReadLine( ); 07 host.Close( ); 08 } You need to create a ServiceHost instance and assign it to the host variable. You also need to instantiate the service host.Which line of code should you insert at line 04?()
    A

    host = new ServiceHost(MyApplication.DataAccessService);

    B

    host = new ServiceHost(MyApplication.DataAccess);

    C

    host = new ServiceHost(typeof(IDataAccess));

    D

    host = new ServiceHost(typeof(DataAccessService));


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

  • 第8题:

    单选题
    12. String csv = “Sue,5,true,3”;  13. Scanner scanner = new Scanner( csv);  14. scanner.useDelimiter(”,”);  15. int age = scanner.nextInt();  What is the result?()
    A

     Compilation fails.

    B

     After line 15, the value of age is 5.

    C

     After line 15, the value of age is 3.

    D

     An exception is thrown at runtime.


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

  • 第9题:

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

    X, followed by an Exception.

    B

    No output, and an Exception is thrown.

    C

    Compilation fails due to an error on line 14.

    D

    Compilation fails due to an error on line 16.

    E

    Compilation fails due to an error on line 17.


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

  • 第10题:

    单选题
    What is the result?()
    A

    Compilation fails because of an error in line 3.

    B

    Compilation fails because of an error in line 7.

    C

    Compilation fails because of an error in line 9.

    D

    If you define D e = new E(),then e.bMethod() invokes the version of bMethod() defined in Line 5.

    E

    If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 5.

    F

    If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 9.


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

  • 第11题:

    单选题
    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
    解析: 暂无解析

  • 第12题:

    单选题
    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();   }   }   The file MyNewVector.java is shown in the exhibit.  What is the result?()
    A

     Compilation will succeed.

    B

     Compilation will fail at line 5.

    C

     Compilation will fail at line 6.

    D

     Compilation will fail at line 14.

    E

     Compilation will fail at line 17.


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

  • 第13题:

    Given: 12.String csv = "Sue,5,true,3"; 13.Scanner scanner = new Scanner( csv ); 14.scanner.useDelimiter(",");15. int age = scanner.nextInt(); What is the result?()

    • A、Compilation fails.
    • B、After line 15, the value of age is 5.
    • C、After line 15, the value of age is 3.
    • D、An exception is thrown at runtime.

    正确答案:D

  • 第14题:

    1. interface A { public void aMethod(); }  2. interface B { public void bMethod(); }  3. interface C extends A,B { public void cMethod(); }  4. class D implements B {  5. public void bMethod() { }  6. }  7. class E extends D implements C {  8. public void aMethod() { }  9. public void bMethod() { }  10. public void cMethod() { }  11. }  What is the result?() 

    • A、 Compilation fails because of an error in line 3.
    • B、 Compilation fails because of an error in line 7.
    • C、 Compilation fails because of an error in line 9.
    • D、 If you define D e = new E(), then e.bMethod() invokes the version of bMethod()defined in Line 5.
    • E、 If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 5.
    • F、 If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.

    正确答案:F

  • 第15题:

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

    Compilation succeeds.

    B

    Compilation fails due to multiple errors.

    C

    Compilation fails due to an error only on line 20.

    D

    Compilation fails due to an error only on line 21.

    E

    Compilation fails due to an error only on line 22.


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

  • 第16题:

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

    Compilation fails due to an error in line 23.

    B

    Compilation fails due to an error in line 29.

    C

    A ClassCastException occurs in line 29.

    D

    A ClassCastException occurs in line 31.

    E

    The value of all four objects prints in natural order.


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

  • 第17题:

    单选题
    Click the Exhibit button. Given this code from Class B: 25.A a1 = new A(); 26.A a2 = new A(); 27.A a3 = new A(); 28.System.out.println(A.getInstanceCount()); What is the result?()
    A

    Compilation of class A fails.

    B

    Line 28 prints the value 3 to System.out.

    C

    Line 28 prints the value 1 to System.out.

    D

    A runtime error occurs when line 25 executes.

    E

    Compilation fails because of an error on line 28.


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

  • 第18题:

    单选题
    Click the Exhibit button.   Given this code from Class B:   25. A a1 = new A();   26. A a2 = new A();   27. A a3 = new A();   28. System.out.println(A.getInstanceCount());   What is the result?()
    A

     Compilation of class A fails.

    B

     Line 28 prints the value 3 to System.out.

    C

     Line 28 prints the value 1 to System.out.

    D

     Compilation fails because of an error on line 28.

    E

     A runtime error occurs when line 25 executes.


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

  • 第19题:

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

    Compilation fails because of an error in line 7.

    B

    Compilation fails because of an error in line 9.

    C

    If you define D e = new E(), then e.bMethod() invokes the version of bMethod() defined in Line 5.

    D

    If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 5.

    E

    If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.


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

  • 第20题:

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

     Compilation fails because of an error in line 13.

    B

     A ClassCastException is thrown at runtime.

    C

     1 2 3

    D

     Compilation fails because of an error in line 14.

    E

     Compilation fails because of an error in line 12.


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

  • 第21题:

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

    An Exception is thrown with no other output

    B

    followed by an Exception

    C

    Compilation fails due to an error on line 9

    D

    Compilation fails due to an error on line 14


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

  • 第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

    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
    解析: 暂无解析