Meaningless Drivel is fun!*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes switch Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "switch" Watch "switch" New topic
Author

switch

Marzen Baldonado
Greenhorn

Joined: Aug 26, 2002
Posts: 2
Correct me if I'm wrong, but in a switch "flow control" it will continue with the remaining cases until it hits a break, even though the case does not match...for example...
int i = 2
switch (i)
case(2)
system.out.println("Value is two");
case 2 + 1
system.out.println("Value is three");
break;
default;
Print out:
Value is two
Value is three
What's up with that?
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi er uh is it work or hard?,
Your going to get a request to change your name to a first and last name from a bartender so be warned. Also, your question is not appropriate for this forum. But since I'm the swell, magnanimous dude that I am, I'll answer it.

Correct me if I'm wrong, but in a switch "flow control" it will continue with the remaining cases until it hits a break, even though the case does not match

Yep.
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Marzen Baldonado
Greenhorn

Joined: Aug 26, 2002
Posts: 2
thanks..I'll change my name...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: switch