下列语句执行后,i的值是( )。 public class Test { public static void main(String[ ] args) { int i =0; for(int j=10; j>5&&i<5; j-=3,i+=2) i=i+j; System. out. println(i); } }
A: 8
B: 9
C: 10
D: 12
A: 8
B: 9
C: 10
D: 12
举一反三
- 下列程序的运行结果是()。 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 ) _
- 下面程序的运行结果是 public class Test { public static void main(String[] args) { int temp = 0; for (int i = 1; i < 5; i++) { for (int j = 0; j < i; j++) { temp++; } } System.out.println(temp); } }
- 以下程序的运行结果为( ) 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 A {public static void main(String[] args){int j = 0;for (int i = 3; i >;= 0; i--) {j += i;System.out.print(j);}}} A: 3566 B: 3522 C: 6753 D: 3255
- 下面程序段的输出结果是( )。 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 7 B: result is 8 C: result is 9 D: result is 10