InterviewSolution
Saved Bookmarks
| 1. |
Default switch case in Java |
|
Answer» A switch statement is a DECISION making statement in Java. It is used to CHECK a variable’s equality against a list of values and their subsequent statements. It is a multiway branch statement. Each condition is called a case and the variable is checked for each case. Syntax for switch case: switch(EXPRESSION) { case value1 : // Statements break; // optional case value2 : // Statements break; // optional . . . . default : // This is the default switch case // Statements }The default statement is optional, and can appear anywhere inside the switch block. |
|