Explain use of String in the switch case in Java?
Can we use String in the switch case?
We can use String in switch case but it is just syntactic sugar. Internally string hash code is used for the switch. See the detailed answer for more explanation and discussion.