+ 3
Java Break Statement Breaks For Loop or not?
I have read most of the places that Break statement terminates the for loop and thereafter next statement is executed. But what if you have used break statement inside an IF condition and the IF condition is inside a FOR loop. So when the IF condition is true and break statement is encountered, would the FOR loop be terminated immediately or will it keep getting executed till the time FOR loop condition run out?
3 odpowiedzi
+ 3
When there is a break included the whole loop will not execute. Especially useful to save time
+ 2
the loop will get terminated whenever it encounters a break statement.