| Author |
sample on illegal use of labeled continue and break
|
Denise Advincula
Ranch Hand
Joined: Jan 01, 2007
Posts: 153
|
|
(Sorry I forgot to quote my source. Anyway, I'm posting it now. ) This is from Chapter 5 (p. 344) of the K&B Book:
Labeled continue and break statements must be inside the loop that has the same label name; otherwise, the code will not compile.
I'm a little lost on this statement. Can anyone give a sample regarding the statement? I'm trying to make my sample code not compile but it compiles fine if I use two different labels - outer and inner. This program is an exercise from the same page, modified a little for my own experimentation. Thank you very much in advance! [ June 25, 2008: Message edited by: Denise Saulon ] [ June 25, 2008: Message edited by: Denise Saulon ] [ June 25, 2008: Message edited by: Denise Saulon ]
|
SCJP/OCPJP 6 | SCWCD/OCPJWCD 5 | OCPJBCD in progress
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 9939
|
|
I think they mean something like this: Note that my "continue inner" is outside of the loop defined by the label "inner". [ June 25, 2008: Message edited by: fred rosenberger ]
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
|
Denise, when you copy a question from a book or mock exam, we require that you quote your sources. So, please tell us where you copied it from.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Denise Advincula
Ranch Hand
Joined: Jan 01, 2007
Posts: 153
|
|
Got it! Thank you very much for the reply!
|
 |
 |
|
|
subject: sample on illegal use of labeled continue and break
|
|
|