Skip to content

Instantly share code, notes, and snippets.

@TomTasche
Created August 11, 2011 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TomTasche/1139335 to your computer and use it in GitHub Desktop.
Save TomTasche/1139335 to your computer and use it in GitHub Desktop.
Use strings in a switch
String name = "abc";
switch (name) {
case "Anton":
System.out.println("a");
break;
case "Berta":
System.out.println("b");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment