Originally posted by Sudhir Bangera:
Hi Preety,
You are right, since 'c' is not found it goes to the default block, but notice that default is not the last statement and it does not have a break in it, so the next statement is displayed which is "I am in case a". If there was no break here too, then the statement "I am in case b" would be displayed too.
note: break is essential to get the correct desired output from a switch construct.
Hope this helps....