The labeled varieties are needed only in situations where you have a nested loop, and need to indicate which of the nested loops you want to break from,or from which of the nested loops you want to continue with the next iteration.
So based on above, in the below code HELO and JILL can be used to break out of which loop?
There are no loops that you can use HELO and JILL to break out of. The "while (c < 8)" loop is labeled by JACK. The other labels do not refer to a loop.
Quite why Java lets you label statements other than loops, I don't know.
The use of labels in loops and breaks has the following rules: 1. Any statement can have a label. 2. If a break statement has a label it must be the label of an enclosing statement. 3. If a continue statement has a label it must be the label of an enclosing loop.
For example
[ October 23, 2006: Message edited by: wise owen ]