To prevent fall-through in a switch case, the ________ keyword is used after each case block.
- break
- continue
- exit
- return
To prevent fall-through in a switch case in Java, you use the break keyword after each case block. This ensures that once a case is matched and executed, the control exits the switch statement and doesn't fall through to subsequent cases.
Loading...
Related Quiz
- Which of the following is an invalid variable name in Java?
- What value is stored at arr[1][2] after executing the following code snippet: int[][] arr = {{1,2,3}, {4,5,6}, {7,8,9}};?
- Which of the following is a key characteristic of a lambda expression in Java?
- In Java 8 and above, the ________ method can be used to perform a certain action for each element of a collection.
- The Platform.runLater() method schedules tasks on the ________.