/*
break: 跳出
使用范围:要么是 switch 语句 要么是循环语句
注意:当break 语句单独存在时,下面不要定义其他语句,因为执行不到
break 跳出的当前的循环语句
*/
class ifDemo
{
public static void main(String[] args)
{
for(int x =1;x<=3;x++)
{
for(int y =1;y<5;y++)
{
System.out.println(x);
}
break;
}
}
break: 跳出
使用范围:要么是 switch 语句 要么是循环语句
注意:当break 语句单独存在时,下面不要定义其他语句,因为执行不到
break 跳出的当前的循环语句
*/
class ifDemo
{
public static void main(String[] args)
{
for(int x =1;x<=3;x++)
{
for(int y =1;y<5;y++)
{
System.out.println(x);
}
break;
}
}
}
/*
continue: 继续:
使用范围:作用范围:循环结构
结束本次循环,继续下次循环,不在继续continue 后面的语句
*/
class ifDemo
{
public static void main(String[] args)
{
for(int x =1;x<=3;x++)
{
System.out.println(x);
continue;
Syytem.out.print("hello");
}
}
}