publicclassX{publicstaticvoidmain(String[]args){Strings1=newString(true”);Booleanb1=newBoolean(true);if(s2.equals(b1)){System.out.printIn(Equal”);}}}Whatistheresult?() A.Theprogramrunsandprintsnothing.B.Theprogramrunsandprints“Equal”C.Anerroratline5causescompilationtofail.D.Theprogramrunsbutabortswithanexception.

publicclassX{publicstaticvoidmain(String[]args){Strings1=newString(true”);Booleanb1=newBoolean(true);if(s2.equals(b1)){System.out.printIn(Equal”);}}}Whatistheresult?()

A.Theprogramrunsandprintsnothing.

B.Theprogramrunsandprints“Equal”

C.Anerroratline5causescompilationtofail.

D.Theprogramrunsbutabortswithanexception.


相关考题:

public class Test{public static void main(String[]args){intx=5;boolean b1=true;boolean b2=false;if((x==4)!b2)System.out.print(l);System.out.print(2);if((b2=true)b1)System.out.print(3);}}What is the result?()A.2B.3C.12D.23E.123F.Compilation fails.G.An exceptional ist hrown at runtime.

publicclassTest{publicstaticvoidmain(String[]args){intx=5;booleanb1=true;booleanb2=false;if((x==4)!b2)System.out.print(”l);System.out.print(”2);if((b2=true)b1)System.out.print(”3);}}Whatistheresult?()A.2B.3C.12D.23E.123F.Compilationfails.G.Auexceptionalisthrownatruntime.

publicclassX{publicstaticvoidmain(String[]args){strings=newstring(Hello”);modify(s);System.out.printIn(s);}publicstaticvoidmodify(Strings){s+=world!”;}}Whatistheresult?() A.Theprogramrunsandprints“Hello”B.Anerrorcausescompilationtofail.C.Theprogramrunsandprints“Helloworld!”D.Theprogramrunsbutabortswithanexception.

publicclassIfTest(publicstaticvoidmain(string[]args){intx=3;inty=1;if(x=y)system.out.printIn(Notequal”);elsesystem.out.printIn(Equal”);})Whatistheresult?() A.Theoutputis“Equal”B.Theoutputin“NotEqual”C.Anerroratline5causescompilationtofall.D.Theprogramexecutesbutdoesnotprintamessage.

publicclassX{publicstaticvoidmain(Stringargs){Strings1=newString(true”);Booleanb1=newBoolean(true);if(s2.equals(b1)){System.out.printIn(Equal”);}}}Whatistheresult?() A.Theprogramrunsandprintsnothing.B.Theprogramrunsandprints“Equal”C.Anerroratline5causescompilationtofail.D.Theprogramrunsbutabortswithanexception.

执行下列程序段之后,变量b的值为( )。 public class Test { public static void main (String[] args) { int i = 12; int j = 24; boolean b1 = true; booleanb=(j%i==0)(! b1) || (j/i! =2); System. out. println (B); } }A.trueB.falseC.0D.1

下列程序的执行结果是______。 public class Test9 { public static void main(String[] args) { String s1 = new String("I am a girl"); String s2 = new String("I am a girl"); System.out.println (s1.equal (s2)); } }A.trueB.假C.I amgirlD.都不正确

当执行下面代码时,会输出( )。 Boolean b1 = new Boolean(true); Boolean b2 = new Boolean(true); if (b1 == b2) if (bi.equals(b2)) System. out.printin ("a"); else System. out. println ("b"); else if (bi.equals(b2)) System. out.println ("c"); else System. out.printIn("d");A.aB.bC.cD.d

执行下列程序段之后,变量b的值为______。 public class Test9 { public static void main(String[] args) { int i=12; int j=24; boolean b1=true; boolean b=(j%i== 0)(!b1) ||(j/i!=2); System.out.println(b); } }A.trueB.假C.1D.0