Java examples for Language Basics:switch
Using string literals in switch statements
public class Main { public static void main(String[] args) { for (String argument : args) { switch (argument) { case "-verbose": case "-v": System.out.println("-v"); break;/* w ww .j ava2 s. c o m*/ case "-log": System.out.println("-log"); break; case "-help": System.out.println("-help"); break; default: System.out.println("Illegal command line argument"); } } } }