Http://blog.sina.com.cn/s/blog_6d5354cd0100xjg7.html
——————————————————————————————————————————————————————————————
The hazard of Goto statement:
The goto statement is a jump at the source level, which incurs a bad reputation. If a program always jumps from one place to another, there is still a way to control the process.
"Goto" in Java:
Although the Goto statement in Java is only a reserved word in Java, it has no effect, but I still find the shadow of the goto statement when I use the continue and break statements today. Because both the continue and break statements support jumping to the location of a label. Here are the specific uses:
Inner
for (int i = 0; i<3; i++) {
System.out.println ("iiii===>" +i);
for (int j=0; j<5; J + +) {
if (j = = 1)
Continue inner;
System.out.println ("j===>" +j);
}
}
The output of the above statement is
Iiii===>0
J===>0
Iiii===>1
J===>0
Iiii===>2
J===>0
The general continue statement jumps out of the current loop, but this jumps out to the position of the marker inner. As you can see from this program, when you jump to the label inner you continue with the For loop instead of starting over again.
Ps:
In Java, the only place the label works is before the iteration statement.
The only reason to use tags in Java is because of the existence of nested loops and to break or continue from multiple layers of nesting.
It turns out that there are also tags like goto statements in Java--java label tags