Why does swing need to use break

  1. The function of break is to interrupt the executed code and exit the current loop.
  2. When there is a break in each case, a switch loop will be launched when a matching switch value is encountered.
  3. When there is no break in each loop, it will judge whether there is a matching value. When it encounters a value that matches the switch, it will enter the execution code. At that time, the subsequent case code will not be judged, and will be executed all unless encountered Break will exit the loop.

Guess you like

Origin blog.csdn.net/springlan/article/details/100678243