0
Switch statement
1.Can anybody tell what is switch statement with an example .... ..plsssss as soon as possible within today 13#............
2 Respostas
+ 4
Please, read carefully! 
• A 'switch' statement checks if a variable is equal to a list of values. The variable in the 'switch' statement can be a 'byte', 'short', 'int', or 'char'.
The syntax of a 'switch' case statement is the following:
switch (variable) {
  case c1:
        statements // they are executed if variable == c1
        break;
  case c2:
        statements // they are executed if variable == c2
        break;
  case c3:
  case c4:
        statements // they are executed if variable == any of the above c's
        break;
  . . .
  default:
        statements // they are executed if none of the above case is satisfied
    break;
}
TRY IT YOURSELF! 👍
https://www.sololearn.com/learn/Java/2145/



