This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
"continue statements must be inside a loop; oitherwise, you'll get a compiler error. break statements must be used inside either a loop or switch statemnts. (Note: This does not apply to labeled break statements".
What is the note driving at?
Where can one use a "labeled break" that is not inside a loop or switch?
SCJP 1.4 (93%)<br />SCJD (In progress. It can run, but it can't hide...)
I interpret this to sort of refer to the labeled-break syntax as a whole, where the actual *label* can be outside the loop, but the 'break:label;' part will still be inside some loop or other. I don't think 'break' can appear outside any loop (or switch).
Joined: Dec 09, 2000
Thanks for the feedback.
I do get what you are saying...but I reckon the text in the book is misleading.
Even a labelled break has to appear in the loop/switch and it is only, as you say, the label that appears outside.
So...in either case, the break statement itself is inisde.