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.2
B.3
C.12
D.23
E.123
F.Compilationfails.
G.Auexceptionalisthrownatruntime.
第1题:
A.finished
B.Compilationfails.
C.AnAssertionErroristhrown.
D.AnAssertionErroristhrownandfinishedisoutput.
Thisquestionisabittrickybecauseitlacksthefollowinginformation:Itshouldincludeastatementthatsayswhetherornotassertionsareenabled.Iftheyareindeedenabled,the
correctionanswerisC.butiftheyarenot,thecorrectanswerisA.Assertionsarenotenabledbydefaultsoifthequestionisnotchanged,themostlogicalanswerisA.
第2题:
执行下列程序段之后,变量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.true
B.false
C.0
D.1
第3题:
执行下列程序段之后,变量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.true
B.假
C.1
D.0
第4题:
A.000000000
B.0123456789
C.Compilationfails.
D.Thecoderunswithnooutput.
E.Thecodeentersaninfiniteloop.
F.Anexceptionisthrownatruntime.
第5题:
A.跳出循环,无输出
B.0121
C.01
D.0123