Java认证考试

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.

题目

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.
如果没有搜索结果,请直接 联系老师 获取答案。
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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

第2题:

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

第3题:

11. String test= “a1b2c3”;  12. String[] tokens = test.split(”//d”);  13. for(String s: tokens) System.out.print(s +“ “);  What is the result?() 

  • A、 a b c
  • B、 1 2 3
  • C、 a1b2c3
  • D、 a1 b2 c3
  • E、 Compilation fails.
  • F、 The code runs with no output.
  • G、 An exception is thrown at runtime.

正确答案:A

第4题:

System.out.println(Math.sqrt(-4D));  What is the result?()  

  • A、 –2
  • B、 NaN
  • C、 Infinity
  • D、 Compilation fails.
  • E、 An exception is thrown at runtime.

正确答案:B

第5题:

11. class Animal { public String noise() { return “peep”; } }  12. class Dog extends Animal {  13. public String noise() { return “bark”; }  14. }  15. class Cat extends Animal {  16. public String noise() { return “meow”; }  17. }  .....  30. Animal animal = new Dog();  31. Cat cat = (Cat)animal;  32. System.out.printIn(cat.noise());  What is the result?() 

  • A、 peep
  • B、 bark
  • C、 meow
  • D、 Compilation fails.
  • E、 An exception is thrown at runtime.

正确答案:E

第6题:

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

第7题:

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

第8题:

public static void main(String[] args) {  String str = “null‟;  if (str == null) {  System.out.println(”null”);  } else (str.length() == 0) {  System.out.println(”zero”);  } else {  System.out.println(”some”);  }  }  What is the result?()

  • A、 null
  • B、 zero
  • C、 some
  • D、 Compilation fails.
  • E、 An exception is thrown at runtime.

正确答案:D

第9题:

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

第10题:

String a = null;  a.concat(“abc”);  a.concat(“def”);  System.out.println(a);   What is the result?()  

  • A、 abc
  • B、 null
  • C、 abcdef
  • D、 Compilation fails.
  • E、 The code runs with no output.
  • F、 An exception is thrown at runtime.

正确答案:F

更多相关问题