Friday, 5 August 2011

jdk 7 update String Switch

import java.util.Scanner;
class Abc {
  public static  void main(String[] ar){
Scanner sc=new Scanner(System.in);
System.out.println("Enter your choice ");
String ch=sc.next();
switch(ch){
 case "yes":
   System.out.println("yes");
break;
case "no":
System.out.println("no");
break;
default :
System.out.println(" i always ok");
}
}

}