Tuesday, 7 February 2017

JAVA PROGRAM TO DO OPERATIONS ON SWITCH CASE

//JAVA PROGRAM TO DO OPERATIONS ON SWITCH CASE



import java.io.*;
class SwitchDemo{
public static void main(String[] ar)
throws IOException{
BufferedReader br= new BufferedReader(
         new InputStreamReader(System.in));
System.out.println("enter your choice:");
String str= br.readLine();
int ch= Integer.parseInt(str);


switch(ch){
case 1: System.out.println("first choice:");
break;
case 2: System.out.println("second choice:");
break;
case 3: System.out.println("third choice:");
break;
case 4: System.out.println("fourth choice:");
break;
default: System.out.println("wrong choice, choose correct choice:");
break;
}
    }
}

No comments:

Post a Comment