break
break Keyword
- The break Keyword is used to get out of the loop or break the given loop when the specific condition is true.
Example:
package quipohouse;
public class BreakStatement {
public static void main(String[] args) {
int i;
for(i=0;i<5;i++)
{
if(i==3)
{
break;
}
System.out.println(i);
}
}
}
Output:
0
1
2