If you define D e = new E(), then e.bMethod() invokes the version of bMethod() defined in Line 5.
If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 5.
Compilation fails because of an error in line 9.
If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.
Compilation fails because of an error in line 3.
Compilation fails because of an error in line 7.
第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? ()
第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?()
第3题:
Compilation fails because of an error in line 3.
Compilation fails because of an error in line 7.
Compilation fails because of an error in line 9.
If you define D e = new E(), then e.bMethod() invokes the version of bMethod()defined in Line 5.
If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 5.
If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.
第4题:
test
null
An exception is thrown at runtime.
Compilation fails because of an error in line 1.
Compilation fails because of an error in line 4.
Compilation fails because of an error in line 5.
第5题:
B
B, followed by an Exception.
Compilation fails due to an error on line 9.
Compilation fails due to an error on line 14.
An Exception is thrown with no other output.
第6题:
Line l = new Line() ; l.Point p = new l.Point();
Line.Point p = new Line.Point();
The Point class cannot be instatiated at line 15.
Point p = new Point();
第7题:
host = new ServiceHost(MyApplication.DataAccessService);
host = new ServiceHost(MyApplication.DataAccess);
host = new ServiceHost(typeof(IDataAccess));
host = new ServiceHost(typeof(DataAccessService));
第8题:
Compilation fails.
After line 15, the value of age is 5.
After line 15, the value of age is 3.
An exception is thrown at runtime.
第9题:
X, followed by an Exception.
No output, and an Exception is thrown.
Compilation fails due to an error on line 14.
Compilation fails due to an error on line 16.
Compilation fails due to an error on line 17.
第10题:
Compilation fails because of an error in line 3.
Compilation fails because of an error in line 7.
Compilation fails because of an error in line 9.
If you define D e = new E(),then e.bMethod() invokes the version of bMethod() defined in Line 5.
If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 5.
If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 9.
第11题:
The code runs with no output.
An exception is thrown at runtime.
Compilation fails because of an error in line 20.
Compilation fails because of an error in line 21.
Compilation fails because of an error in line 23.
Compilation fails because of an error in line 25.
第12题:
Compilation will succeed.
Compilation will fail at line 5.
Compilation will fail at line 6.
Compilation will fail at line 14.
Compilation will fail at line 17.
第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?()
第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?()
第15题:
Compilation succeeds.
Compilation fails due to multiple errors.
Compilation fails due to an error only on line 20.
Compilation fails due to an error only on line 21.
Compilation fails due to an error only on line 22.
第16题:
Compilation fails due to an error in line 23.
Compilation fails due to an error in line 29.
A ClassCastException occurs in line 29.
A ClassCastException occurs in line 31.
The value of all four objects prints in natural order.
第17题:
Compilation of class A fails.
Line 28 prints the value 3 to System.out.
Line 28 prints the value 1 to System.out.
A runtime error occurs when line 25 executes.
Compilation fails because of an error on line 28.
第18题:
Compilation of class A fails.
Line 28 prints the value 3 to System.out.
Line 28 prints the value 1 to System.out.
Compilation fails because of an error on line 28.
A runtime error occurs when line 25 executes.
第19题:
Compilation fails because of an error in line 7.
Compilation fails because of an error in line 9.
If you define D e = new E(), then e.bMethod() invokes the version of bMethod() defined in Line 5.
If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 5.
If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.
第20题:
Compilation fails because of an error in line 13.
A ClassCastException is thrown at runtime.
1 2 3
Compilation fails because of an error in line 14.
Compilation fails because of an error in line 12.
第21题:
An Exception is thrown with no other output
followed by an Exception
Compilation fails due to an error on line 9
Compilation fails due to an error on line 14
第22题:
True
Not true
An exception is thrown at runtime.
Compilation fails because of an error at line 12.
Compilation fails because of an error at line 19.
第23题:
B
The code runs with no output.
Compilation fails because of an error in line 12.
Compilation fails because of an error in line 15.
Compilation fails because of an error in line 18.