break
Usage scenarios: terminating switch or cyclic
in structure selection switch statement
loop statement in
Leaving the scene of the existence of use does not make sense
public static void main (String [] args) { for ( int I =. 1; I <= 10; I ++ ) { // requirements: after completing the print end of cycle twice the HelloWorld IF (I ==. 3 ) { BREAK ; } the System .out.println ( "the HelloWorld" + I); } }
continue
Usage scenarios: the end of this cycle, the next cycle continues
public static void main (String [] args) { for ( int I =. 1; I <= 10; I ++ ) { // requirements: Third not print the HelloWorld IF (I ==. 3 ) { Continue ; } the System.out .println ( "the HelloWorld" + I); } }
Implemented while loop
public static void Chengfa () { int I = 0 ; the while (I <=. 9 ) { // requirements: Third not print the HelloWorld I ++ ; IF (I ==. 3 ) { Continue ; } System.out.println ( " the HelloWorld "+ I); } }