LIKE, SHARE & SUBSCRIBE
Switch statement is a multi-branch selection statement. By using switch statement we can control the order of execution of our Java code.
Here controlling process is based on an expression, which is compared to the different case's value. These cases contain statements which get executed if the case and expression value gets matched.
We can make as many cases as we desire. That's why it is a better alternative for else-if statements. By using switch statements for the control of execution order, our code's readability gets improved.
We also include "default" case in our switch statements so that we can verify that whether our case gets executed or not. This is not mandatory, but we must include it so that we can track the execution order.
Data types allowed in switch statements.
1) byte
2) short
3) int
4) char
Wrapper classes like Byte, Short, Integer, Character & ENUMs (Enumerated Data Type) were also included in JDK 1.5 version.
String class was also included in JDK 1.7 version.
If, If-Else, Else-If Statement Condition in Java : • 26 - If, If Else, Else If Statements ...
Thanks for watching & stay tuned.
Like us on Facebook - https://goo.gl/y7oxYc
Follow us on Twitter - https://goo.gl/UKmTfn
En esta página del sitio puede ver el video en línea 27 - Switch Statement in Java (Hindi/Urdu) de Duración hora minuto segunda en buena calidad , que subió el usuario Uncovering Technologies 26 junio 2018, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 7,593 veces y le gustó 238 a los espectadores. Disfruta viendo!