Goto: Goto is still a reserved word in Java, but it is not used in the language, and Java has no goto.
Definition of reserved words:
Reserved words (reserved word), which are words that have already been defined in a high-level language, can no longer be used by users as variable names or procedure names.
Reserved words include keywords and unused reserved words. Keywords are those words that have a specific meaning in the language and become part of the grammar. In some languages, some reserved words may not be applied to the current syntax, which is the difference between a reserved word and a keyword. In general, this may be due to scalability considerations. For example, JavaScript has some future reserved words, such as abstract, double, Goto, and so on.
Each programming language has its own set of reserved words.
Java uses continue and break to perform some similar jumps.
But continue and break are not a jump, but a way to interrupt an iterative statement.
outer-iteration {
inter-iteration {
Break Interrupts internal iterations, back to external iterations
Continue Move the execution point back to the beginning of the internal iteration
}
}
After the continue and break are tagged:
Outlabel:
outer-iteration {
Inlabel:
inter-iteration {
Break Inlabel; Interrupts the inner iteration (inter-iteration referred to by Inlabel), back to the outer iteration, here with break; equivalence
Break outlable; Interrupts both internal and external iterations, and does not re-enter iterations
Continue Inlabel; Moves the execution point back to the beginning of the inner iteration (inter-iteration referred to by Inlabel), here and continue; equivalence
Continue Outlabel; Moves the execution point to the beginning of the outer iteration (the outer-iteration referred to by Outlabel)
}
}
In Java, a label can only work if it pail into any statement before the iteration statement and between the iteration statement.
The only reason to use tags in Java is because of the existence of nested loops, and to break and continue from multiple layers of nesting.
Goto,continue,break in Java