The continue of the Java loop jump statement
The function of continue is to skip the remaining statements in the loop body to perform the next loop.
For example, print all the even numbers between 1--10, use the Continue statement to implement code: 650) this.width=650; "style=" width:340px; "src=" http://img.mukewang.com/ 536b50410001d1a706020200.jpg "/>
Operation Result: 650) this.width=650; "src=" http://img.mukewang.com/536b50770001d42a00350109.jpg "/>
Code:
public class HelloWorld {
public static void Main (string[] args) {
int sum = 0; Save Cumulative value
for (int i = 1; i <=; i++) {
If I is an odd number, end the cycle and proceed to the next cycle
if (i%2==1) {
Continue
}
sum = sum + i;
}
System.out.print ("1 to 10 of all even numbers and for:" + sum);
}
}
Operation Result:
1 to 10 for all even numbers and for: 30
This article is from "Ghost" blog, please make sure to keep this source http://caizi.blog.51cto.com/5234706/1547779
Java Foundation--java Loop Jump statement Continue (26)