public class Foo { public static void main (String []args) { int i = 1; int j = i++; if ((i>++j) && (i++ ==j)) { i +=j; } } } What is the final value of i?()
第1题:
下面程序的输出结果是( )。 public class Sun { public static void main(String args[ ]) { int x=0; for(int i=1;i<=4;i++) { x=4; for(int j=1;j<=3;j++) { x=3; for(int k=1;k<=2;k++) { x-x+6; } } } System.out.println(x); } }
A.7
B.15
C.157
D.538
第2题:
请阅读下面程序
public class Test {
public static void main (String[] args) {
int i,j;
for (i=1;i<5;i++) {
for (j=1;j<=i;j++)
system.out.print (i+"X"+j+"="+i*j+" ");
System.out.println();
}
}
}
程序执行完后,i循环和j循环执行的次数分别是【 】。
第3题:
下列程序的执行结果为( )。 public class c3 { public static void main(String args[]) { int i=13, j=10; if(i-->j) i++; else j--; System.out.println(i+"\t"+j); } }
A.13 10
B.12 11
C.11 11
D.12 12
第4题:
下列程序执行后,j的值是 public class Testggg { public static void main(String args[ ]) { int j=1; for(int i=7;i>0;i-=2) j * =2; System.out.println(j); } }
A.15
B.1
C.32
D.16
第5题:
请阅读下面程序 public class ForLoopStatement { public static void main(string []args){ int i,j; for (i=1; i<5; i++) { //i循环 for (j=1;j<=i;j++) //j循环 System.out.print(i+"×"+j+"="+i*j+" "); System.out.println(); } } } 程序完成后,i循环和j循环执行的次数分别是
A.4,10
B.8,9
C.9,8
D.10,10
第6题:
顺序执行下面的语句后,输出的结果是______。
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]);
}
}
第7题:
下列程序运行后的输出结果为( )。 public class Test { public static void main (String args[]) { int i,j,p,s; s=0; for (i=1;i<=4; i++) { p=1; for(j=1;j<=i:j++) p=p*j; s=s+p; } System.out.println(s); } }
A.46
B.33
C.30
D.40
第8题:
阅读下面的程序段: publiC class Sun { public static void main (String args[ ]) { int a=0; for(int i=1;i<=3;i++) { for(int j=1;j<=i;j++) { for(int k=j;k<=3;k++) { a=a+1; } } } System.out.println(A) ; } } 执行上面的3重循环后,a的值为( )。
A.3
B.9
C.14
D.21
第9题:
A.5 5
B.5 4
C.6 4
D.5 6
第10题:
下面程序段的输出结果是( )。 public class Test t public static void main(String[] args) { int x=0; for (int i=1;i<=4;i++) { x=4; for(int j=1;j<=3; j++) { x=3; for(int k=1; k<=2; k++) x=x+6; } } System. out. println (x); } }
A.36
B.48
C.144
D.15