Java Blog

 
 
 
 public class JAVA_025
 {

    public static void main(String[] args)
    {
       int number=(int)(Math.random( )*10);

       switch(number)
       {
          case 0 :
          case 1 : System.out.println(\"Random Number Generated is 0 or 1 : \"+number);
                   break;

          case 2 :
          case 3 :
          case 4 :
          case 5 : System.out.println(\"Random Number Generated is bewteen 2 to 5 : \"+number);
                   break;

          case 6 :
          case 7 :
          case 8 :
          case 9 : System.out.println(\"Random Number Generated is between 6 to 9 : \"+number);
                   break;
       }
    }
 }