break with if statement java code example
Example: break statement in java
// break statement in java
public class BreakStatementExample
{
public static void main(String[] args)
{
for(int a = 1; a <= 10; a++)
{
if(a == 3)
{
// breaking loop
break;
}
System.out.println(a);
}
}
}