Continue Statement in Java
Continue Statement in Java
Continue key word will skip the remaining code in the loop and it will move to conditional statement for the next iteration.Continue will skip only the particular iteration remaining block of code in the loop but break will terminate the entire loop statement.
Example:
Public class Test{ Public static void main(String[] args){ For(int i=1;i<=10;i++){ If(i%2==0){ Continue; }else{ System.out.println(i); } } } }
Output:
1 3 5 7 9
Click Here-> Get Java Training with Real-time Projects