网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

补全代码:执行下面程序,程序输出结果为:0 1 2 3 class Program{ public void printArray(){ int[] ia = new int[4]; for (int i = 0; i < ia.Length; i++){ ia[i] = i; Console.Write("{0} ", ia[i]); } } static void Main(string[] args){ Program lin = new Program(); ________; } }

A.lin.printArray()

B.Console.Write("{0} {1} {2} {3}");

C.printArray()

D.Console.Write(0123);


参考答案和解析
10
更多 “补全代码:执行下面程序,程序输出结果为:0 1 2 3 class Program{ public void printArray(){ int[] ia = new int[4]; for (int i = 0; i < ia.Length; i++){ ia[i] = i; Console.Write("{0} ", ia[i]); } } static void Main(string[] args){ Program lin = new Program(); ________; } }A.lin.printArray()B.Console.Write("{0} {1} {2} {3}");C.printArray()D.Console.Write(0123);” 相关考题
考题 执行下列程序段之后,输出的结果为______。public class exl0{public static void main(String[] args){int i=3;int j=7;int k=8;boolean b=j>i∧k!=i;System.out.println(b);}}

考题 下面程序段的输出结果是( )。 public class Test {public static void main(String args[]){ int[] a=new int[11]; int[] p=new int[4]; int k=5; for(int i= 1 ; i<= 10;i++) a[i]=i; for(int i=1 ; i<=3;i++) p[i]=a[i*i]; for(int i= 1 ;i<=3;i++) k=k+p[i]*2; System.out.println(k); }}A.37B.31C.33D.35

考题 顺序执行下面的语句后,输出的结果是______。public class exl6{public static void main(String[] args){int i;int a[] = new int[10];for(i = O; i < a.length; i++)a[i] = i * 10 + j;for(i = 1; i < a.length; i++)if(a[i]%5 == O)System,out.println(a[i]);}}

考题 下面程序段的输出结果是 public class Test { public static void main(String args[]){ int[] a=new int[11]; int[] p=new int[4]; int k=5; for(int i=1;i<=10;i++) a[i]=i; for(int i=l;i<=3;i++) p[i]=a[i*i]; for(int i=1;i<=3;i++) k=k+p[i]*2; System.out.println(k); } }A.37B.31C.33D.35

考题 下面程序段的输出结果是( )。 public class Test { public static void main ( String[] args) { int result=0; for ( int i=1;i<=5;i++) { if ( i%2==0 ) continue; result + =i; } System. out. println ("result is " + result ); } }A.result is 7B.result is 8C.result is 9D.result is 10

考题 下列程序的执行结果是 ( ) 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.运行成功,但不输出

考题 下列代码的执行结果是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[]){ for(int i=0; i<3;i++){ if(i<2) continue; System.out.println(i); } } }A.0B.1C.2D.3

考题 下列程序执行后的结果是______。public class ex24{public static void main(String[] args){int j=10;a1: for(int i=3;i>0;i--){j-=i;int m=l;a2: while (m<j){if (i<=m)continue a1;j/=m++;}}System.out.println(j);}}下列嵌套的循环程序执行后,结果是______。 public class ax25 { public static void main(String[] args) { int sum=0; for(int i=0;i<=5;i++) { for(int j=10;j>3*i;j--) { sum+=j*i; } } System.out.println(sum); } }A.136B.127C.147D.153

考题 下列程序输出结果为( )。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 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.

考题 下面程序的输出结果是( )。 public class Sun { public static void main(String args[]) { int[] a={1,2,3,4); int j=1,s=0; for(int i=3;i>=0;i--) { s=s+a[i]*j; j=j*10; } System.out.println(s); } }A.1234B.21C.43D.4321

考题 下面程序段的输出结果是( )。 public class Test( public static void main(String args[]){ int[]a=new int[113; int[]p=new int[43; int k=5: for(int i=1;i=10;i++) a[i]=i; for(int i=1;i=3;i++) p[i]=a[i*i]; for(int i=1;i=3;i++) k=k+p[i]*2; System.out.println(k); } }A.37B.31C.33D.35

考题 下列代码的执行结果是 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.运行成功,但不输出

考题 在注释//Start For loop 处要插入哪段代码可实现根据变量i的值定位数组ia[]的元素?public class Lin{public void amethod(){int ia[] = new int[4];//Start For loop{ia[i]=i;System.out.println(ia[i]);}}} A. for (int i=0; iB. for (int i=0; iC. for (int i=1; iD. for (int i=0; i

考题 以下程序的输出结果为:public class example {public static void main(String args[]) {int i=0;for (i=0;i A.0123 B.0122 C.123 D.234

考题 public class test {  public static void add3 (Integer i)  int val = i.intValue ( );  val += 3;  i = new Integer (val);  } public static void main (String args [ ] )  {  Integer  i = new Integer (0);  add3 (i);  system.out.printIn (i.intValue ( )  );  } What is the result?()  A、 Compilation will fail.B、 The program prints “0”.C、 The program prints “3”.D、 Compilation will succeed but an exception will be thrown at line 3.

考题 public class test (   private static int j = 0;     private static boolean methodB(int k) (  j += k;    return true;   )    public static void methodA(int i) {    boolean b:   b = i  10 | methodB (4);    b = i  10 || methodB (8);   )     public static void main (String args) } (    methodA (0);  system.out.printIn(j);   )    )   What is the result?()  A、 The program prints “0”B、 The program prints “4”C、 The program prints “8”D、 The program prints “12”E、 The code does not complete.

考题 现有: class TestApp{ public static void main (String[] args){ for (int i=0; iA、0123B、012456789C、0123456789D、012

考题 public class ForBar {   public static void main(String args) {   int i = 0, j = 5;   tp: for (;;) {   i ++;   for(;;)   if(i  --j) break tp;   }   system.out.printIn(“i = ” + i + “, j = “+ j);   }   }   What is the result? () A、 The program runs and prints “i=1, j=0”B、 The program runs and prints “i=1, j=4”C、 The program runs and prints “i=3, j=4”D、 The program runs and prints “i=3, j=0”E、 An error at line 4 causes compilation to fail.F、 An error at line 7 causes compilation to fail.

考题 What will be the result of attempting to compile and run the following program?()   public class Q28fd {   public static void main(String args[]) {   int counter = 0;   l1:   for (int i=10; i0; i--) {   l2:  int j = 0;   while (j  10) {   if (j  i) break l2;   if (i == j) {   counter++;   continue l1;   }   }   counter--;   }   System.out.println(counter);  }   }   A、The program will fail to compile.B、The program will not terminate normally.C、The program will write 10 to the standard output.D、The program will write 0 to the standard output.E、The program will write 9 to the standard output.

考题 public class Test {  public int aMethod() {  static int i = 0;  i++;  return i;  }  public static void main (String args[]) {  Test test = new Test();  test.aMethod();  int j = test.aMethod();  System.out.println(j);  }  }  What is the result?()  A、 0B、 1C、 2D、 Compilation fails.

考题 单选题class super (   public int I = 0;   public super (string text) (   I = 1   )   )     public class sub extends super (   public sub (string text) (   i= 2   )   public static void main (straing args) (  sub sub = new sub (“Hello”);   system.out. PrintIn(sub.i);  )   )   What is the result?()A  Compilation will fail.B  Compilation will succeed and the program will print “0”C  Compilation will succeed and the program will print “1”D  Compilation will succeed and the program will print “2”

考题 单选题public class test(    public int aMethod()[   static int i=0;   i++;   return I;   )    public static void main (String args){   test test = new test();    test.aMethod();   int j = test.aMethod();   System.out.printIn(j);   ]  }   What is the result?()A  Compilation will fail.B  Compilation will succeed and the program will print “0”C  Compilation will succeed and the program will print “1”D  Compilation will succeed and the program will print “2”

考题 单选题public class test (      private static int j = 0;  private static boolean methodB(int k) (  j += k;  return true;  )  public static void methodA(int  i)(  boolean b:     b = i  10 | methodB (4);  b = i  10 || methodB (8);  )  public static void main (String args[])(   methodA (0);  system.out.printIn(j);  )  )   What is the result?()A  The program prints “0”B  The program prints “4”C  The program prints “8”D  The program prints “12”E  The code does not complete.

考题 单选题public class test {   public static void add3 (Integer i){  int val = i.intValue ( );   val += 3;   i = new Integer (val);    }     public static void main (String args [ ] )  { Integer i = new Integer (0);    add3 (i);   system.out.printIn (i.intValue ( ) );   }    }   What is the result?()A  Compilation will fail.B  The program prints “0”.C  The program prints “3”.D  Compilation will succeed but an exception will be thrown at line 3.

考题 单选题现有: class TestApp{ public static void main (String[] args){ for (int i=0; i A 0123B 012456789C 0123456789D 012