you could do such a thing in C language. basically
java does not have a goto statement.
because break and continue are nothing but transfer of control, just like goto in procedural languages.
In java break and continue are to be used with
for, while and do-while loops. And second the labels have to just before where the for,while statements are. You cannot place your labels anywhere you want.
Originally posted by kumar bangali:
Hi
This clarification is regarding the use of labels in flow control. I was under the impression that labels could be used to pass control to any statement and not necessarily to the start of the loop alone. But in the following examples the code does not compile in (1) and (2) but compiles fine in (3)
(1)
2
3
Thanx in advance