This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes label Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "label" Watch "label" New topic
Author

label

Sireesha Mullapudi
Ranch Hand

Joined: Jun 26, 2006
Posts: 74
Hi,

Why this is not giving compile time error.




here the label is not placed before any loop

Thanks
SCJP1.4
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
A label can appear before other statements too. You don't have to put it at the beginning of a loop.
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
Hi all,

I added JOHN as well:


I think, break JACK; is ok, because JACK belongs to the while loop.
both break JILL; and break JOHN; won't compile.

Yours,
Bu.
prashanth kumar
Ranch Hand

Joined: Mar 22, 2004
Posts: 162
>>I think, break JACK; is ok, because JACK belongs to the while loop.
>>both break JILL; and break JOHN; won't compile.

I tried this code and everything will compile...The compiler will throw an error only when a reference is made to a label with a BREAK statement.
Else the code will compile even though LABEL is placed in NON-LOOP places.

Rgds
Prashanth


SCJP1.5(86%)<br />SCWCD1.4(95%)<br />SCBCD1.3(92%)<br />IBM 252
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: label