且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无限循环Java

更新时间:2023-11-03 08:54:16

您有两个while,然后尝试使用一个中断来摆脱它,但您只是从内部while离开

You have two while and then you try to use a break to get out of it, but you're just getting out of the inner while.

要脱离这两个while,您需要更改程序逻辑或使用标签(是的,Java可以使用标签,并且一次从内部循环和外部循环中断开是其用途之一) )

To get out of both whiles, you need to change your program logic or use labels (yes, Java can use labels, and to break from an inner loop and of the outter loop at once is one of it's uses)