break、continue
package ds;
public class Dome14 {
public static void main(String[] args) {
int i =0;
while (i<100){
i++;
System.out.println(i);
if (i==30);{
break;
}
}
}
}
//break在循环中,终止循环,退出循环
package ds;
public class Dome15 {
public static void main(String[] args) {
int i = 0;
while (i<100){
i++;
if (i%10==0){
System.out.println();
continue;
}
System.out.println(i);
}
}
}
/*continue在循环中,终止某处循环,就是跳过这一次循环,进入下一次循环*/
package ds;
public class Dome16 {
public static void main(String[] args) {
for (int i = 1; i<=10; i++){
for (int j = 10; j>=i; j--);{
System.out.print(" ");
}
for (int j = 1; j <=i ; j++);{
System.out.print("罗");
}
for (int j = 1; j < i; j++);{
System.out.print("*");
}
System.out.println();
}
}}