Thursday 30 June 2011

JDk 1.7 ~String in Switch and Multi Catch~

JDK 1.7 also supports using String in your switch case and multi catch option as shown under.




Swicth case is alternative to your if else condition but only when you need to check for the equality condition(Switch will not support < or > )
When there is choice to be made between if else or switch,its better to opt to switch because of readabilty and fastness in execution (Jump table or Branch table concepts)....thats it for now cheeeers !! ;-)

No comments:

Post a Comment