Break will kill the closest / innermost loop containing the break. In your example, a break will kill do-while, and control goes to the for () loop and just starts the next iteration of for ().
However, since you change x in both the do () AND and for () loops, the execution will be a bit inconvenient. You will get an infinite loop when outer X reaches 5.
Marc b
source share