First, use the break and continue keywords
. 1 public class BreakContinueTest { 2 public static void main (String args []) { . 3 for ( int I =. 1; I <= 10; I ++ ) { . 4 IF (I%. 4 == 0 ) { . 5 // BREAK; / / output: 123 . 6 Continue ; // output: 1,235,679 10 . 7 } . 8 System.out.println (I); . 9 } 10 } . 11 12 is }