Showing posts with label switch ( ). Show all posts
Showing posts with label switch ( ). Show all posts

Java switch / Chapter -2 / Flow Control



Java switch

java switch statement:-





  • This is the second part of selection Statement. if -else we have already discussed in previous chapter 1 / Flow Control.



  • If multiple options are available then it is not recommended to use nested if-else.To meet this requirement we should go for the switch ( ) Statement.


Syntax:-

                    switch ( x )

                    {


                     case 1: Action -1

                                 break;


                     case 2: Action -2

                                 break;



                     case 3: Action -3

                                 break;




                     case 4: Action -4

                                 break;



                     default : default Action


                      }

Java-switch ( ) / Chapter -2 / Flow Control

2. switch ( ):- 
  • This is the second part of selection Statement . if -else we have already discussed in previous chapter 1 / Flow Control.
  • If multiple options are available then it is not recommended to use  nested if-else.To meet this requirement we should go for the switch ( ) Statement.
Syntax:-
                    switch ( x )
                    {

                     case 1: Action -1
                                 break;


                     case 2: Action -2
                                 break;

                     case 3: Action -3
                                 break;

                     case 4: Action -4
                                 break;
                     
                     default : default Action
                     
                      }

Flipkart End Of Season Sale






© Copyright 2017 Javabychetan.blogspot.com