下列程序的执行结果是______。 class A1 implements Runnable { public void run() { for(iht i = 0; i < 10; i++) { System.out.println("i =" + i); if(i == 3) break; } } } public class ex38 { public static void main(String[] args) { Thread th1 = new Thread(new A1()); th1.start (); } }
A: i=1 i=2 i=3 i=4
B: i=1 i=1 i=1 i=1
C: i=0 i=1 i=2 i=3
D: i=1 i=2 i=3
A: i=1 i=2 i=3 i=4
B: i=1 i=1 i=1 i=1
C: i=0 i=1 i=2 i=3
D: i=1 i=2 i=3
C
举一反三
- 以下程序的输出结果是【 】。 class Program { public static void Main(string[] args) { int[] a = new int[3] { 1, 2, 3 }; for (int i = 0; i < 3; i++) Console.Write("{0} ", a[i]); Console.WriteLine(); int[] b = a; for (int i = 0; i < 3; i++) b[i] = 2 * b[i]; for (int i = 0; i < 3; i++) Console.Write("{0} ", a[i]); Console.WriteLine(); Console.Read(); } }[/i][/i][/i][/i]
- 顺序执行下面的语句后,输出的结果是。 public class A{ public static void main(String[] args){ int i; int a[]=new int[10]; for(i=0;i<a.length;i++) a[i]=i*10+i; for(i=1;i<a.length;i++) if(a[i]%5==0) System.out.println(a[i]); } }
- 【单选题】给出以下代码,请问该程序的运行结果是什么?() class Example{ public static void main(String args[]){ loop1: for(int i=0;i<3;i++){ loop2: for(int j=0;j<3;j++){ if(i==j){ break loop2; } System.out.println("i="+i+"j="+j+""); } } } } A. i=1 j=0 B. i=1 j=0 i=2 j=1 C. i=0 j=1 i=0 j=2 i=1 j=0 i=2 j=0 i=2 j=1 D. i=1j=0 i=2j=0 i=2j=1
- 以下程序的运行结果为( ) public class Ex6 { public static void main(String[] args) { int i,j,k; for(i=0;i<3;i++){ for(j=1;j<4;j++){ for(k=2;k<5;k++){ if((i==j)&&(j==k)) System.out.println(i); } } } } }
- 下列程序的运行结果是()。 public class Test public static void main ( String [ ] args ) int count = 0 for( int i = 1 i < 5 i = 2) for( int j = 1 j< = 10 j = 3) count System .out .print (count ) _
内容
- 0
下面语句执行结果为( ) public static void main(String[] args){ int i=4; if(i<0){ i=1;}
- 1
以下程序的运行结果为( )。public class Test { public static void main(String args[ ]) { int i=0, j=2; do { i=++i; j--; } while(j>0); System.out.println(i); }} A: 0 B: 1 C: 2 D: 3
- 2
以下程序调试结果 public class test { public static void main(String args[]) { int i=1, j=3; while (j>0) { j--; i++; } System.out.println(i); } }
- 3
有以下程序,运行结果是()。 main() { int s[12]={1, 2, 3, 4, 4, 3, 2, 1, 1, 1, 2, 3}, c[5]={0}, i; for(i=0; i<12; i++) c[s[i]]++; for(i=1; i<5; i++) printf("%d", c[i]); printf("\n"); }
- 4
以下代码的输出结果是_________。 public static void main(String[] args){ for(int i=1;i<=10;i++){ if(i%2==0 || i%5==0){ continue; } System.out.print(i+"\t"); } }