24 Jan 2017

Basic Rules applied on Switch statements !!

First of all keep it in mind that java is securest language and inspired by real life .So first , lets imagine your childhood as you play with your self, as throwing a ball against stairs and it will have been come back step by step .....🙂🙂


  • The first rule that you keep it in mind is that every switch statements variable must be Integer, convertible Integers(byte,char,short) .

  • The break statement is used with end of case statement .If you don't use the break statement then the sub case value is execute after the true case value .

  • Default statement is must be tie in the body of switch.It is like else part if the no. of case value is not true then the default statement is executed.

Lets take an example of switch statements : Switch_Examples 



No comments:

Post a Comment