public class ExBreakAndcontinue {
/**
* @param args
*/
public static void main(String[] args) {
System.out.println("################### FOR ######################");
for (int i = 0; i < 10; i++) {
if (i == 9) {
System.out.println("i=9 then must be break.");
break;
}
if ((i == 2)||(i == 4)||(i == 8)) {
continue;
}
System.out.println("Order [" + i + "] ");
}
System.out.println("################### WHILE ######################");
int b=0;
while(true){
if (b == 9) {
System.out.println("i=9 then must be break.");
b++;
break;
}
if ((b == 2)||(b == 4)||(b == 8)) {
b++;
continue;
}
System.out.println("Order [" + b + "] ");
b++;
}
}
}