The difference between keywords continue, break, and return in Java:
Continue: Jump out of this loop to continue the next cycle
Break: Jumps out of the loop body and resumes execution of the function body outside the loop
Return: Jumps out of the entire function body, the part behind the function body no longer executes
There is code for the truth:
<span style= "FONT-FAMILY:SIMSUN;FONT-SIZE:14PX;" ><span style= "FONT-FAMILY:SIMSUN;FONT-SIZE:14PX;" >public class Javabese {public static void main (string[] args) {int j = 3;for (int i = 0; i < 5; i++) {if (i = = j) c0/>{continue;} System.out.println ("i =" + i);} System.out.pintln ("Loop Over");}} </span></span>
Printing results are:
i = 0
i = 1
i = 2
i = 4
i = 5
End of cycle
If it is break, the print result is:
i = 0
i = 1
i = 2
End of cycle
If it is return, the result of the printing is:
i = 0
i = 1
i = 2
The difference between keywords continue, break, and return in Java