Instantly share code, notes, and snippets.

Embed
What would you like to do?
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