In a switch case, the ________ keyword is used to specify the code that should be executed if no case matches.
- default
- defaultcase
- else
- fallback
In a switch case in Java, the default keyword is used to specify the code that should be executed if none of the case labels match the switch expression. It acts as a fallback or default option when no other case matches the switch expression.
Loading...
Related Quiz
- Which of the following sorting algorithms is most efficient in terms of average-case time complexity?
- In a scenario where you are developing a JavaFX application with multiple scenes and want to preserve the state when switching between these scenes, how would you manage and transfer data between them?
- Which access modifier allows a member to be accessed from within its own class only?
- The ______ interface is used when you want a task to return a value after execution in a thread.
- How does Binary Search perform when there are multiple occurrences of the search key in the data?