If line 10 is removed, the compilation succeeds.
If line 11 is removed, the compilation succeeds.
If line 12 is removed, the compilation succeeds.
If line 13 is removed, the compilation succeeds.
More than one line must be removed for compilation to succeed.
第1题:
1. interface foo { 2. int k = 0; 3. } 4. 5. public class test implements Foo ( 6. public static void main(String args[]) ( 7. int i; 8. Test test = new test (); 9. i= test.k; 10.i= Test.k; 11.i= Foo.k; 12.) 13.) 14. What is the result?()
第2题:
interface foo { int k = 0; } public class test implements Foo ( public static void main(String args) ( int i; Test test = new test (); i= test.k; i= Test.k; i= Foo.k; ) ) What is the result? ()
第3题:
Compilation will succeed for all classes and interfaces.
Compilation of class C will fail because of an error in line 2.
Compilation of class C will fail because of an error in line 6.
Compilation of class AImpl will fail because of an error in line 2.
第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题:
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.
第7题:
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.
第8题:
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.
第9题:
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.
第10题:
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.
第11题:
Compilation succeeds and 1 is printed.
complication succeeds and 2 is printed.
An error at line 8 causes compilation to fail.
An error at line 13 causes complication to fail.
An error at line 14 causes compilation to fail.
第12题:
Compilation succeeds.
An error at line 2 causes compilation to fail.
An error at line 9 causes compilation to fail.
An error at line 10 causes compilation to fail.
An error at line 11 causes compilation to fail.
第13题:
public class X { public static void main (String[] args) { byte b = 127; byte c = 126; byte d = b + c; } } Which statement is true?()
第14题:
Compilation succeeds.
An error at line 2 causes compilation to fail.
An error at line 9 causes compilation to fail.
An error at line 10 causes compilation to fail.
An error at line 11 causes compilation to fail.
第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 succeeds and d takes the value 253.
Line 5 contains an error that prevents compilation.
Line 5 throws an exception indicating “Out of range”
Line 3 and 4 contain error that prevent compilation.
The compilation succeeds and d takes the value of 1.
第18题:
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.
第19题:
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
第20题:
Compilation succeeds.
Class A does not compile.
The method declared on line 9 cannot be modified to throw TestException.
TestA compiles if line 10 is enclosed in a try/catch block that catches TestException.
第21题:
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.
第22题:
Compilation succeeds and 1 is printed.
Compilation succeeds and 2 is printed.
An error at line 8 causes compilation to fail.
An error at line 14 causes compilation to fail.
第23题:
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.