Break and Continue
package code . mypack ; public class src { public static void main ( String [] args ) { for ( int i = 1 ; i < 6 ; i ++ ){ System . out . println ( i ); //the loop ends after i==2 as we used break statement if ( i == 2 ){ break ; } } for ( int i = 0 ; i < 6 ; i ++ ) { System . out . println ( i ); if ( i == 2 ){ continue ; } //here java is not printed as the continue statement ignores the print statement and continues the iteration System . out . println ( "java" ); } } }