//输出100-200内的质数
public class testContinue2 {
public static void main ( String args[] ) {
for (int i =101; i < 200; i +=2) {
boolean f = true;
for (int j = 2; j < i; j++ ) {
if (i % j == 0) {
f = false;
break;
}
}
if (!f) {continue;}
System.out.print(" " + i);
}
}
}
---------------------------------------以下是改成while的
public class testContinue2 {
public static void main ( String args[] ) {
int i =101;
while ( i < 200 ) {
boolean f = true;
for (int j = 2; j < i; j++ ) {
if (i % j == 0) {
f = false;
break;
}
}
if (!f) {continue;}
System.out.print(" " + i);
i += 2;
}
}
}
while的显示了101、103之后就卡死了,估计死循环了