Java basic switch statement plus {} problem
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-27 17:41:47
0
2
752

Why do some books include double quotes here?
It can run with or without addition, is there any difference?

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(2)
刘奇

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template