A very simple java program for Break Statement

  1. public class  Break{  
  2.     public static void main(String[] args){  
  3.         int i,j;  
  4.         System.out.println("Prime numbers between 1 to 50 : ");  
  5.         for (i = 1;i < 50;i++ ){  
  6.             for (j = 2;j < i;j++ ){  
  7.                 if(i % j == 0)  
  8.                 {  
  9.                     break;  
  10.                 }  
  11.             }  
  12.             if(i == j)  
  13.             {  
  14.                 System.out.print("  " + i);  
  15.             }  
  16.         }  
  17.     }