I\'m confused about this. Most of us have been told that there isn\'t any goto statement in Java.
But I found that it is one of the keywords in Java. Where can it be
An example of how to use "continue" labels in Java is:
public class Label {
public static void main(String[] args) {
int temp = 0;
out: // label
for (int i = 0; i < 3; ++i) {
System.out.println("I am here");
for (int j = 0; j < 20; ++j) {
if(temp==0) {
System.out.println("j: " + j);
if (j == 1) {
temp = j;
continue out; // goto label "out"
}
}
}
}
System.out.println("temp = " + temp);
}
}
Results:
I am here // i=0
j: 0
j: 1
I am here // i=1
I am here // i=2
temp = 1