单选题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.

参考答案和解析
正确答案: D
解析: 暂无解析
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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] = 0
  • B、 f[0] = 0.0
  • C、 Compilation fails.
  • D、 An exception is thrown at runtime.

正确答案:B

第2题:

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 = null
  • C、 baz = blue
  • D、 Compilation fails.
  • E、 An exception is thrown at runtime.

正确答案:E

第3题:

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 end
  • B、 Compilation fails.
  • C、 test runtime end
  • D、 test exception end
  • E、 A Throwable is thrown by main at runtime.

正确答案:D

第4题:

public class Test {  private static int[] x;  public static void main(String[] args) {  System.out.println(x[0]);  }  }   What is the result?()   

  • A、 0
  • B、 null
  • C、 Compilation fails.
  • D、 A NullPointerException is thrown at runtime.
  • E、 An ArrayIndexOutOfBoundsException is thrown at runtime.

正确答案:D

第5题:

11. String test = “This is a test”;  12. String[] tokens = test.split(”/s”);  13. System.out.println(tokens.length);  What is the result?() 

  • A、 0
  • B、 1
  • C、 4
  • D、 Compilation fails.
  • E、 An exception is thrown at runtime.

正确答案:D

第6题:

public class Test {  public static void main(String[] args) {  String str = NULL;  System.out.println(str);  }  }   What is the result?()  

  • A、 NULL
  • B、 Compilation fails.
  • C、 The code runs with no output.
  • D、 An exception is thrown at runtime.

正确答案:B

第7题:

public class Foo {  public static void main(String[] args) {  try {  return;  } finally {  System.out.println( “Finally” );  }  }  }  What is the result?()

  • A、 Finally
  • B、 Compilation fails.
  • C、 The code runs with no output.
  • D、 An exception is thrown at runtime.

正确答案:A

第8题:

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、 1
  • C、 4
  • D、 Compilation fails.
  • E、 0

正确答案:D

第9题:

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、 collie
  • B、 harrier
  • C、 Compilation fails.
  • D、 collie harrier
  • E、 An exception is thrown at runtime.

正确答案:D

第10题:

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、 end
  • B、 Compilation fails.
  • C、 exception end
  • D、 exception test end
  • E、 A Throwable is thrown by main.
  • F、 An Exception is thrown by main.

正确答案:E

更多相关问题