aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes how label work ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "how label work ?" Watch "how label work ?" New topic
Author

how label work ?

Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
can someone pls tell how label work and the scope of coverage by label ?



is that means, if mylabel have labeled, the scope for "mylabel" label cover 2 for loop ? thank you very much for explain
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
The for statement includes the block it controls.

This is one statement:
for ( i = 1; i <= 10; i++ ) { sum += i; product *= i; }

This is one labeled staement:
myLabel: for ( i = 1; i <= 10; i++ ) { sum += i; product *= i; }

The label only controls the one statement immediately following, so in your example, mylabel controls the first for statement.


Mike Gershman
SCJP 1.4, SCWCD in process
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
thanks mike
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how label work ?