Stringa=null;a.concat(abc”);a.concat(def”);System.out.println(a);Whatistheresult?() A.abcB.nullC.abcdefD.Compilationfails.E.Thecoderunswithnooutput.F.Anexceptionisthrownatruntime.
Stringa=null;a.concat(abc”);a.concat(def”);System.out.println(a);Whatistheresult?()
A.abc
B.null
C.abcdef
D.Compilationfails.
E.Thecoderunswithnooutput.
F.Anexceptionisthrownatruntime.
相关考题:
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.nullB.zeroC.someD.Compilationfails.E.Anexceptionisthrownatruntime.
publicstaticvoidmain(String[]args){try{args=null;args[0]=test”;System.out.println(args[0]);}catch(Exceptionex){System.out.println(”Exception”);}catch(NullPointerExceptionnpe){System.out.println(”NullPointerException”);}}Whatistheresult?()A.testB.ExceptionC.Compilationfails.D.NullPointerException
publicstaticvoidmain(String[]args){Stringstr=null?;if(str==null){System.out.println(”null”);}else(str.length()==0){System.out.println(”zero”);}else{System.out.println(”some”);}}Whatistheresult?() A.nullB.zeroC.someD.Compilationfails.E.Anexceptionisthrownatruntime.
classTestA{publicvoidstart(){System.out.println(”TestA”);}}publicclassTestBextendsTestA{publicvoidstart(){System.out.println(”TestB”);}publicstaticvoidmain(String[]args){((TestA)newTestB()).start();}}Whatistheresult?()A.TestAB.TestBC.Compilationfails.D.Anexceptionisthrownatruntime.
classParent{Stringone,two; classParent{Stringone,two;publicParent(Stringa,Stringb){one=a;two=b;}publicvoidprint(){System.out.println(one);}}publicclassChildextendsParent{publicChild(Stringa,Stringb){super(a,b);}publicvoidprint(){System.out.println(one+to+two);}publicstaticvoidmain(Stringarg[]){Parentp=newParent(south,north);Parentt=newChild(east,west);p.print();t.print();}}Whichofthefollowingiscorrect?()
Giventhefollowingcode:publicclassPerson{intarr[]=newint[10];publicstaticvoidmain(Stringa[]){System.out.println(arr[1]);}}Whichstatementiscorrect?() A.Whencompilationsomeerrorwilloccur.B.Itiscorrectwhencompilationbutwillcauseerrorwhenrunning.C.Theoutputiszero.D.Theoutputisnull.
Stringa=ABCD”;Stringb=a.toLowerCase();b.replace(‘a’,‘d’);b.replace(‘b’,‘c’);System.out.println(b);Whatistheresult?() A.abcdB.ABCDC.dccdD.dcbaE.Compilationfails.F.Anexceptionisthrownatruntime.
publicclassTest{publicstaticvoidmain(String[]args){Stringstr=NULL;System.out.println(str);}}Whatistheresult?() A.NULLB.Compilationfails.C.Thecoderunswithnooutput.D.Anexceptionisthrownatruntime.
try{if((newObject))(.equals((newObject()))){System.out.println(equal”);}else{System.out.println(notequal”);}}catch(Exceptione){System.out.println(exception”);}Whatistheresult?() A.equalB.notequalC.exceptionD.Compilationfails.
try{intx=0;inty=5/x;}catch(Exceptione){System.out.println(Exception”);}catch(ArithmeticExceptionae){System.out.println(ArithmeticException”);}System.out.println(finished”);Whatistheresult?() A.finishedB.ExceptionC.Compilationfails.D.ArithmeticException
booleanbool=true;if(bool=false){System.out.println(“a”);}elseif(bool){System.out.println(“c”);}elseif(!bool){System.out.println(“c”);}else{System.out.println(“d”);}Whatistheresult?() A.aB.bC.cD.dE.Compilationfails.
publicclassTest{publicstaticvoidaMethod()throwsException{try{thrownewException();}finally{System.out.println(finally”);}}publicstaticvoidmain(Stringargs[]){try{aMethod();}catch(Exceptione){System.out.println(exception”);}System.out.println(finished”);}}Whatistheresult?()A.finallyB.exceptionfinishedC.finallyexceptionfinishedD.Compilationfails.
定义一个表示10个值为null的字符串数组,下面选项正确的是( )。A.String[]a;B.Stringa[];C.chara[10][];D.Stringa[]=new String[10];
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、 nullB、 zeroC、 someD、 Compilation fails.E、 An exception is thrown at runtime.
vara=[“a”,“b”,“c”];varb=[“d”,“e”,“f”];有a,b两个数组,下面哪个选项可以把a,b合成一个新的数组()。A、全不正确B、varc=a.push()+b.push()C、varc=a.concat(b)D、varc=a.join(b)
String a = null; a.concat(“abc”); a.concat(“def”); System.out.println(a); What is the result?() A、 abcB、 nullC、 abcdefD、 Compilation fails.E、 The code runs with no output.F、 An exception is thrown at runtime.
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、nullB、zeroC、someD、Compilationfails.E、Anexceptionisthrownatruntime.
319机型救生船存放位置().A、4ABC/DEF、11ABC/DEF、22ABC/DEFB、4ABC、11ABC/DEF、22ABC/DEFC、4ABC/DEF、11DEF、22ABC/DEFD、4ABC/DEF、11ABC/DEF、22DEF
单选题String a = null; a.concat(“abc”); a.concat(“def”); System.out.println(a); What is the result?()A abcB nullC abcdefD Compilation fails.E The code runs with no output.F An exception is thrown at runtime.
单选题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 nullB zeroC someD Compilation fails.E An exception is thrown at runtime.