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.
相关问题推荐
-
public class Test { public static void main(String [] args) { boolean assert = true; if(assert) { System.out.println(”assert is true”); } } } Given: javac -source 1.3 Test.java What is the result?()
A、 Compilation fails.
B、 Compilation succeeds with errors.
C、 Compilation succeeds with warnings.
D、 Compilation succeeds without warnings or errors.
-
//point X public class foo ( public static void main (Stringargs) throws Exception { printWriter out = new PrintWriter (new ) java.io.outputStreamWriter (System.out), true; out.printIn(“Hello”); } ) Which statement at PointX on line 1 allows this code to compile and run?()
A、 Import java.io.PrintWriter;
B、 Include java.io.PrintWriter;
C、 Import java.io.OutputStreamWriter;
D、 Include java.io.OutputStreamWriter;
E、 No statement is needed.
-
What are four valid examples of polymorphic method calls?()
Ax.a2();
Bz.a2();
Cz.c1();
Dz.a1();
Ey.c1();
Fx.a1();
-
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.
-
10. interface Foo { int bar(); } 11. public class Sprite { 12. public int fubar( Foo foo) { return foo.bar(); } 13. public void testFoo() { 14. fubar( 15. // insert code here 16.); 17. } 18. } Which code, inserted at line 15, allows the class Sprite to compile?()
A、 Foo { public int bar() { return 1; } }
B、 new Foo { public int bar() { return 1; } }
C、 newFoo() { public int bar(){return 1; } }
D、 new class Foo { public int bar() { return 1; } }