• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SWITCH

 
Honey Khumalo
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens if the switch statement tests false?
 
Anubhav Anand
Ranch Hand
Posts: 341
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A switch statement works for a key


For key values you can use int or enum constants(JDK 5.0).

Now, if a key is supplied the switch body is executed. If a case is met then the appropriate action is performed. If no case is tested true then control goes to default statement and it is executed. In case there is no default then switch block is ended without any action.

Hope that helps.

[Should have mentioned this before]
PS. Please don't write subject line in caps as it is considered rude and is like shouting in the forum.
[ April 03, 2008: Message edited by: Anubhav Anand ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic