Monday, March 30, 2015

java–Switch Case

java–Switch Case

 

 

import java.util.Scanner;
 
public class Switch {
    static Scanner a = new Scanner(System.in);
    
    public static void main(String[] args) {
        
        int b;
        System.out.println("ENter :");
        b = a.nextInt();
        switch(b)
        {
        case 1:
            System.out.println("1");
        break;
        case 2:
            System.out.println("2");
        break;
        case 3:
            System.out.println("3");
        break;
        default:
            System.out.println("4");
        }
    }
}

No comments:

Post a Comment