Java Blog

 
 
 
 public class JAVA_024
 {

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

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

          case 1 : System.out.println(\"Random Number Generated is One (1)\");
                   break;

          case 2 : System.out.println(\"Random Number Generated is Two (2)\");
                   break;

          case 3 : System.out.println(\"Random Number Generated is Three (3)\");
                   break;

          case 4 : System.out.println(\"Random Number Generated is Four (4)\");
                   break;
       }
    }
 }

 
 
Didn't find what you were looking for? Find more on Program to show the use of Switch Statement