Expression:
1)The value placed inside the parameters of a switch keyword is an
expression
Ex: switch(value)
2)The expression allows the primitive datatypes like(byte,short,int,char)
and it also allows the non-primitive datatype(String)
case:
1)It is a keyword
2)Once the case value matchs,it will excute all the case values in a
switchcase
3)To avoid this we use a break keyword( break; )
4)It can access a multiple values by(,)
break:
1)After the excutation of the matching case value,it will exits from the loop and stop the excutation
2)After the 12th version of java,the break is not necessary,to
tally the need of break, we use( case value:-> )
3)It reduced the line of the program
switch case:
1)It is a keyword
2)It is to start the switch statement
3)It is to check the multiple values against the expression and
excute the value,when the case value matchs with an expression
default:
1)When all the case are failed,then defualt will be excuted
Top comments (0)