单选题Given: What is the result?()A test endB Compilation fails.C test runtime endD test exception endE A Throwable is thrown by main at runtime.
单选题
Given: What is the result?()
A
test end
B
Compilation fails.
C
test runtime end
D
test exception end
E
A Throwable is thrown by main at runtime.
参考解析
解析:
暂无解析
相关考题:
static void test() throws RuntimeException { try { System.out.print(”test “); throw new RuntimeException(); } catch (Exception ex) { System.out.print(”exception “); } } public static void main(String[] args) { try { test(); } catch (RuntimeException ex) { System.out.print(”runtime “); } System.out.print(”end “); } What is the result?() A、 test endB、 Compilation fails.C、 test runtime endD、 test exception endE、 A Throwable is thrown by main at runtime.
Given: 11. String test = "This is a test"; 12. String[] tokens = test.split("/s"); 13. System.out.println(tokens.length); What is the result?()A、 An exception is thrown at runtime.B、 1C、 4D、 Compilation fails.E、 0
public class Test { private static float[] f = new float[2]; public static void main(String args[]) { System.out.println(“f[0] = “ + f[0]); } } What is the result?() A、 f[0] = 0B、 f[0] = 0.0C、 Compilation fails.D、 An exception is thrown at runtime.
public class Test { public static void main(String[] args) { String str = NULL; System.out.println(str); } } What is the result?() A、 NULLB、 Compilation fails.C、 The code runs with no output.D、 An exception is thrown at runtime.
public class Test { public static void main( String[] args) { String foo = args[1]; String bar = args[2]; String baz = args[3]; System.out.println(“baz = “ + baz); } } And the command line invocation: java Test red green blue What is the result?() A、 baz =B、 baz = nullC、 baz = blueD、 Compilation fails.E、 An exception is thrown at runtime.
public class Foo { public static void main(String[] args) { try { return; } finally { System.out.println( “Finally” ); } } } What is the result?()A、 FinallyB、 Compilation fails.C、 The code runs with no output.D、 An exception is thrown at runtime.
11. String test = “This is a test”; 12. String[] tokens = test.split(”/s”); 13. System.out.println(tokens.length); What is the result?() A、 0B、 1C、 4D、 Compilation fails.E、 An exception is thrown at runtime.
public class Test { public enum Dogs {collie, harrier}; public static void main(String [] args) { Dogs myDog = Dogs.collie; switch (myDog) { case collie: System.out.print(”collie “); case harrier: System.out.print(”harrier “); } } } What is the result?() A、 collieB、 harrierC、 Compilation fails.D、 collie harrierE、 An exception is thrown at runtime.
public class Test { private static int[] x; public static void main(String[] args) { System.out.println(x[0]); } } What is the result?() A、 0B、 nullC、 Compilation fails.D、 A NullPointerException is thrown at runtime.E、 An ArrayIndexOutOfBoundsException is thrown at runtime.
static void test() throws Error { if (true) throw new AssertionError(); System.out.print(”test “); } public static void main(String[] args) { try { test(); } catch (Exception ex) { System.out.print(”exception “); } System.out.print(”elld “); } What is the result?() A、 endB、 Compilation fails.C、 exception endD、 exception test endE、 A Throwable is thrown by main.F、 An Exception is thrown by main.
public static void test(String str) { int check = 4; if (check = str.length()) { System.out.print(str.charAt(check -= 1) +“, “); } else { System.out.print(str.charAt(0) + “, “); } } and the invocation: test(”four”); test(”tee”); test(”to”); What is the result?() A、 r, t, t,B、 r, e, o,C、 Compilation fails.D、 An exception is thrown at runtime.
public class Test { public static void main(String [] args) { System.out.println(args.length 4 args[4].equals(“-d”)); } } If the program is invoked using the command line: java Test One Two Three –d What is the result?() A、 trueB、 falseC、 Compilation fails.D、 An exception is thrown at runtime.
单选题Given: What is the result?()A collieB harrierC Compilation fails.D collie harrierE An exception is thrown at runtime.
单选题public class Test { private static float[] f = new float[2]; public static void main(String args[]) { System.out.println(“f[0] = “ + f[0]); } } What is the result?()A f[0] = 0B f[0] = 0.0C Compilation fails.D An exception is thrown at runtime.
单选题public class Test { private static int[] x; public static void main(String[] args) { System.out.println(x[0]); } } What is the result?()A 0B nullC Compilation fails.D A NullPointerException is thrown at runtime.E An ArrayIndexOutOfBoundsException is thrown at runtime.
单选题Given: What is the result?()A r, t, t,B r, e, o,C Compilation fails.D An exception is thrown at runtime.
单选题public class Test { public static void main(String [] args) { System.out.println(args.length 4 args[4].equals(“-d”)); } } If the program is invoked using the command line: java Test One Two Three –d What is the result?()A trueB falseC Compilation fails.D An exception is thrown at runtime.
单选题Given: What is the result?()A TestAB TestBC Compilation fails.D An exception is thrown at runtime.
单选题static void test() throws RuntimeException { try { System.out.print(”test “); throw new RuntimeException(); } catch (Exception ex) { System.out.print(”exception “); } } public static void main(String[] args) { try { test(); } catch (RuntimeException ex) { System.out.print(”runtime “); } System.out.print(”end “); } What is the result?()A test endB Compilation fails.C test runtime endD test exception endE A Throwable is thrown by main at runtime.
单选题public class Test { public static void main( String[] args) { String foo = args[1]; String bar = args[2]; String baz = args[3]; System.out.println(“baz = “ + baz); } } And the command line invocation: java Test red green blue What is the result?()A baz =B baz = nullC baz = blueD Compilation fails.E An exception is thrown at runtime.
单选题Given: 11. String test = "This is a test"; 12. String[] tokens = test.split("/s"); 13. System.out.println(tokens.length); What is the result?()A An exception is thrown at runtime.B 1C 4D Compilation fails.E 0
单选题Given: What is the result?()A peepB barkC meowD Compilation fails.E An exception is thrown at runtime.
单选题public static void test(String str) { int check = 4; if (check = str.length()) { System.out.print(str.charAt(check -= 1) +“, “); } else { System.out.print(str.charAt(0) + “, “); } } and the invocation: test(”four”); test(”tee”); test(”to”); What is the result?()A r, t, t,B r, e, o,C Compilation fails.D An exception is thrown at runtime.
单选题static void test() throws Error { if (true) throw new AssertionError(); System.out.print(”test “); } public static void main(String[] args) { try { test(); } catch (Exception ex) { System.out.print(”exception “); } System.out.print(”elld “); } What is the result?()A endB Compilation fails.C exception endD exception test endE A Throwable is thrown by main.F An Exception is thrown by main.
单选题public class Foo { public static void main(String[] args) { try { return; } finally { System.out.println( “Finally” ); } } } What is the result?()A FinallyB Compilation fails.C The code runs with no output.D An exception is thrown at runtime.
单选题11. String test = “This is a test”; 12. String[] tokens = test.split(”/s”); 13. System.out.println(tokens.length); What is the result?()A 0B 1C 4D Compilation fails.E An exception is thrown at runtime.
单选题public class Test { public static void main(String[] args) { String str = NULL; System.out.println(str); } } What is the result?()A NULLB Compilation fails.C The code runs with no output.D An exception is thrown at runtime.