• 2022-06-18
    下列程序的执行结果是______。 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
  • C

    内容

    • 0

      下面语句执行结果为(    ) public static void main(String&#91;&#93; args){ int i=4; if(i<0){ i=1;}

    • 1

      以下程序的运行结果为( )。public class Test { public static void main(String args&#91; &#93;) { 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"); } }