Skip to content

Instantly share code, notes, and snippets.

@OOPUniversity
Created November 9, 2015 14:50
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 OOPUniversity/ca733c868a7c3225e240 to your computer and use it in GitHub Desktop.
Save OOPUniversity/ca733c868a7c3225e240 to your computer and use it in GitHub Desktop.
Demonstration for blog post 'The Old Switcheroo'
package main.java.com.oopuniversity.basics.conditionals;
/**
* Created by OOPUniversity on 11/9/2015.
*/
public class SwitchDemo {
public static void main(String[] args) {
switchDemo();
}
public static void switchDemo() {
for (int switchValue = 0; switchValue < 5; switchValue ++) {
switch (switchValue) {
case 0:
System.out.println("Just starting out.");
break;
case 1:
System.out.println("Making progress.");
break;
case 4:
System.out.println("All done.");
break;
case 5:
System.out.println("We will never get here.");
break;
default:
System.out.println("Getting there...");
break;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment