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.
第1题:
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?()
第2题:
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?()
第3题:
B
The code runs with no output.
An exception is thrown at runtime.
Compilation fails because of an error in line 15.
Compilation fails because of an error in line 18.
Compilation fails because of an error in line 19.
第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题:
Canada
null Canada
Canada null
Canada Canada
Compilation fails due to an error on line 26.
Compilation fails due to an error on line 29.
第6题:
42
An exception is thrown at runtime.
Compilation fails because of an error on line 12.
Compilation fails because of an error on line 16.
Compilation fails because of an error on line 17.
第7题:
Compilation succeeds.
Compilation fails because of an error at line 5.
Compilation fails because of an error at line 6.
Compilation fails because of an error at line 14.
Compilation fails because of an error at line 17.
第8题:
three
other
An exception is thrown at runtime.
Compilation fails because of an error on line 12.
Compilation fails because of an error on line 13.
Compilation fails because of an error on line 15.
第9题:
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.
第10题:
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
第11题:
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.
第12题:
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.
第13题:
11.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?()
第14题:
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? ()
第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题:
1 2 3
Compilation fails because of an error in line 12.
Compilation fails because of an error in line 13.
Compilation fails because of an error in line 14.
A ClassCastException is thrown at runtime.
第18题:
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.
第19题:
Canada
null Canada
Canada null
Canada Canada
Compilation fails due to an error on line 26.
第20题:
Compilation fails because of an error in line 19.
An exception is thrown at runtime.
B
Compilation fails because of an error in line 18.
Compilation fails because of an error in line 15.
The code runs with no output.
第21题:
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.
第22题:
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.
Compilation fails due to an error only on line 12.
第23题:
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.