The statements in the case block are not actually the focus. As long as you reach this branch, you can just execute it. As for the problem of {} and double quotes you mentioned, adding {} means it is a block. Adding double quotes should be a string. , generally note that the case value of switch is generally of byte, char, short, int or enum type. The String type is supported after JDK1.7.
Theoretically there is no difference, each case is an independent code block
The statements in the case block are not actually the focus. As long as you reach this branch, you can just execute it. As for the problem of {} and double quotes you mentioned, adding {} means it is a block. Adding double quotes should be a string. , generally note that the case value of switch is generally of byte, char, short, int or enum type. The String type is supported after JDK1.7.