publicclassTest{publicstaticvoidleftshift(inti,intj){i=j;}publicstaticvoidmain(Stringargs){inti=4,j=2;leftshift(i,j);System.out.printIn(i);}}Whatistheresult?() A.2B.4C.8D.16E.Thecodewillnotcompile.

publicclassTest{publicstaticvoidleftshift(inti,intj){i<<=j;}publicstaticvoidmain(Stringargs){inti=4,j=2;leftshift(i,j);System.out.printIn(i);}}Whatistheresult?()

A.2

B.4

C.8

D.16

E.Thecodewillnotcompile.


相关考题:

publicclassTest{publicstaticvoidleftshift(inti,intj){i=j;}publicstaticvoidmain(Stringargs[]){inti=4,j=2;leftshift(i,j);System.out.printIn(i);}}Whatistheresult?() A.2B.4C.8D.16E.Thecodewillnotcompile.

publicclasstest(privatestaticintj=0;privatestaticbooleanmethodB(intk)(j+=k;returntrue;)publicstaticvoidmethodA(inti)(booleanb:b=i10|methodB(4);b=i10||methodB(8);)publicstaticvoidmain(Stringargs[])(methodA(0);system.out.printIn(j);))Whatistheresult?()A.Theprogramprints“0”B.Theprogramprints“4”C.Theprogramprints“8”D.Theprogramprints“12”E.Thecodedoesnotcomplete.

publicclassTest{publicstaticvoidmain(StringArgs[]){inti=1,j=0;switch(i){case2:j+=6;case4:j+=1;default:j+=2;case0:j+=4;}System.out.println(j=”+j);}}Whatistheresult?() A.0B.2C.4D.6E.9F.13

publicclassForBar{publicstaticvoidmain(Stringargs){inti=0,j=5;tp:for(;;){i++;for(;;)if(i--j)breaktp;}system.out.printIn(i=”+i+,j=+j);}}Whatistheresult?() A.Theprogramrunsandprints“i=1,j=0”B.Theprogramrunsandprints“i=1,j=4”C.Theprogramrunsandprints“i=3,j=4”D.Theprogramrunsandprints“i=3,j=0”E.Anerroratline4causescompilationtofail.F.Anerroratline7causescompilationtofail.

publicclassFoo{publicstaticvoidmain(Stringargs){inti=1;intj=i++;if((i++j)(i++==j)){i+=j;}}}Whatisthefinalvalueofi?() A.1B.2C.3D.4E.5

下列程序输出结果为( )。public class test { public static void main(String args[]) { int a=0; outer: for(int i=0;i<2;i++) { for(int j=0;j<2;j++) { if(j>i) { continue outer; } a++; } } System.out.println(a); }}A.0B.2C.3D.4

下列程序执行后,j的值是( )。 public class Test { public static void main(String args[]) { int j=1; for(int i=7;i>0;i-=2) j*=2; System.out.println(j); } }A.15B.1C.32D.16

下列程序输出结果为( )。 public class test { public static void main (String args[]) { int a=0; outer:for(int i=0;i<2;i + +) { for(int j=0;j<2;j+ +) { if(j>i) { continue outer; } a+ +; } } System.out.println(a); } }A.0B.2C.3D.4

下列程序执行后,j的值是( )。 public class Test { public static void main(String args[]) { int j=1; for(int i=7; i>0; i-=2) j*=2; System.out.println(j); } }A.15B.1C.32D.16