public class SwtichCaseStatements {
/**
* @param args
*/
public static void main(String[] args) {
outer:
for (int i = 0; i < 5; i++)
{
int step = i;
out.println("=====================");
out.format("Step = %s\n", step);
switch (step)
{
case 3:
out.println(3); // you can break outer, so in this case, if you hit 1, then yo will break out of the for loop
break outer;
case 2:
out.println(2);
case 1:
out.println(1);
case 0:
out.println(0);
break;
default:
out.println("...");
break;
}
}
}
}
转载于:https://my.oschina.net/u/854138/blog/101296