Like Us

header ads

Switch Case Java

/**
 * 5 switch case
 * 1 doctor
 * 2 engg
 * 3 acct
 * 4 doctra
 * 5 other
 * User can give the input
 * other than this "Selection list not available"
 */
package JavaLearning;

import java.util.Scanner;

public class SwitchCase {

public static void main(String[] args) {
// TODO Auto-generated method stub
 Scanner in = new Scanner(System.in);
 int getIntVal;
 System.out.println("Enter the integer ");
 getIntVal = in.nextInt();

 switch(getIntVal){


 case 1:System.out.println("Doctor");break;
 case 2:System.out.println("engg");break;
 case 3:System.out.println("acct");break;
 case 4:System.out.println("doctr");break;
 case 5:System.out.println("other");break;
 default:System.out.println("it not a correct value");



 }


}



}

Post a Comment

0 Comments