Java 7 supports String type in switch case label

class Main
{
public static void main(String args[])
{

  String people="men";

  switch(fruit)
              {

               case "women":
               System.out.println("Women");
               break;
              
 
              case "men":
              System.out.println("Women");
              break;
                  
              default:
               System.out.println("people");

             }

 }

}
 

Comments