This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes switch and labeled break Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "switch and labeled break" Watch "switch and labeled break" New topic

switch and labeled break

Pawanpreet Singh
Ranch Hand

Joined: Jun 12, 2005
Posts: 264

I just want to know that can we use labeled switch as we use labled loops or a labeled body.

1) This is switch without label

2) switch with label, here break abc; statement should skip the default case also. The control should come out of swicth body but it comes out of for loop only. Please justify the both one.

[ August 27, 2005: Message edited by: Michael Ernest ]
Michael Ernest
High Plains Drifter

Joined: Oct 25, 2000
Posts: 7292

You cannot break out of a case statement back to the original switch.

Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
I agree. Here's the link:
subject: switch and labeled break
Similar Threads
Please help me out this problem.look at last line
Help with loop label problem
Please solve this program and help me out clearly
Dan's Exam on Flow control
about "for" and "if-else" ??