null
finally
null finally
Compilation fails.
finally exception
第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?()
第2题:
static void test() { try { String x=null; System.out.print(x.toString() +“ “); } finally { System.out.print(“finally “); } } public static void main(String[] args) { try { test(); } catch (Exception ex) { System.out.print(”exception “); } } What is the result?()
第3题:
staticvoidtest(){try{Stringx=null;System.out.print(x.toString()+);}finally{System.out.print(finally);}}publicstaticvoidmain(String[]args){try{test();}catch(Exceptionex){System.out.print(”exception);}}Whatistheresult?()
A.null
B.finally
C.nullfinally
D.Compilationfails.
E.finallyexception
第4题:
Given: String[] elements = { "for", "tea", "too" }; String first = (elements.length > 0) ? elements[0] : null; What is the result?()
第5题:
System.out.println(Math.sqrt(-4D)); What is the result?()
第6题:
public class Test { public static void main(String[] args) { String str = NULL; System.out.println(str); } } What is the result?()
第7题:
public class Test { public static void aMethod() throws Exception { try { throw new Exception(); } finally { System.out.println(“finally”); } } public static void main(String args[]) { try { aMethod(); } catch (Exception e) { System.out.println(“exception”); } System.out.println(“finished”); } } What is the result?()
第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?()
第9题:
String a = null; a.concat(“abc”); a.concat(“def”); System.out.println(a); What is the result?()
第10题:
null
finally
null finally
Compilation fails.
finally exception