publicclassTest{publicintaMethod(){staticinti=0;i++;returni;}publicstaticvoidmain(Stringargs[]){Testtest=newTest();test.aMethod();intj=test.aMethod();System.out.println(j);}}Whatistheresult?() A.0B.1C.2D.Compilationfails.
publicclassTest{publicintaMethod(){staticinti=0;i++;returni;}publicstaticvoidmain(Stringargs[]){Testtest=newTest();test.aMethod();intj=test.aMethod();System.out.println(j);}}Whatistheresult?()
A.0
B.1
C.2
D.Compilationfails.
相关考题:
下列程序的执行结果是 ( ) public class Test { public int aMethod() { satic int i=0; i++; System.out.println(i); } public static void.main(String args[]) { Test test=new Test(); test.aMethod(); }A.编译错误B.0C.1D.运行成功,但不输出
publicclasstest(publicintaMethod()[staticinti=0;i++;returnI;)publicstaticvoidmain(Stringargs[]){testtest=newtest();test.aMethod();intj=test.aMethod();System.out.printIn(j);]}Whatistheresult?() A.Compilationwillfail.B.Compilationwillsucceedandtheprogramwillprint“0”C.Compilationwillsucceedandtheprogramwillprint“1”D.Compilationwillsucceedandtheprogramwillprint“2”
publicclasstest(publicintaMethod()[staticinti=0;i++;returnI;)publicstaticvoidmain(Stringargs){testtest=newtest();test.aMethod();intj=test.aMethod();System.out.printIn(j);]}Whatistheresult?() A.Compilationwillfail.B.Compilationwillsucceedandtheprogramwillprint“0”C.Compilationwillsucceedandtheprogramwillprint“1”D.Compilationwillsucceedandtheprogramwillprint“2”
下列代码的执行结果是public class Test{ public int aMethod(){ static int i=0; i++; System.out.println(i); } public static void main(String args[]){ Test test= new Test(); test. aMethod(); }}A.编译错误B.0C.1D.运行成功,但不输出
下列程序输出结果为( )。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
下列代码的执行结果是( )。public class Test{public int aMethod( ){static int i=0;i++;System.out.println(i):}public static void main (String args[]){Trest test=new Test ( );test aMethod( ):}}A.编译错误B.0C.1D.运行成功,但不输出B.C.D.
下列程序执行后,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