Break and Continue Example in Java


Here is the simple program for printing basic example using Break and Continue in Java.

Source Code

import java.io.*;
import java.util.Scanner;
class break_continue
{// Tutor Joes Computer Education
  public static void main(String args[])
  {
   int i;
   for(i=0;i<10;i++)
   {
    if(i==5)
    {
      continue;
    }
    else if(i==8)
    {
      break;
    }
    else
    {
      System.out.println("Value : "+i);
    }
   }
  }
}
To download raw file Click Here

Output

Value : 0
Value : 1
Value : 2
Value : 3
Value : 4
Value : 6
Value : 7


Learn All in Tamil © Designed & Developed By Tutor Joes