Intro of JAVA
Learn Java
Jump statement are used to skip specific statement or jump to another part of statement.Following statements are under category of jump statement:
If loop encountered break keyword anywhere in loop it will terminate that part of loop.Once break keyword is encountered it will terminate program.No more loop will iterate or incr/decr.
Syntax:
jump-statement;
break;
Program of break:
public class Jump{
public static void main(String[]args){
for(int i=1;i<=10;i++){
if(i==5){
break;}
System.out.println( "value is" +i);
}
}
}
Output: