Tuesday, December 8, 2015

java Switch Case:

java Switch Case:

package pkgclass;

import java.util.Scanner;

public class SwitchCondition {
    public static void main(String[] args) {
       
   
    Scanner obj = new Scanner(System.in);
    int input= obj.nextInt();
   
    switch (input) {
   
        case 1:
            System.out.println("hello");break;
        case 2:
            System.out.println("hi");break;
            case 3:
            System.out.println("Namaste");break;
            default:
                System.out.println("bye");
    }
    }
}

0 comments:

Post a Comment