Created
November 9, 2015 14:50
-
-
Save OOPUniversity/ca733c868a7c3225e240 to your computer and use it in GitHub Desktop.
Demonstration for blog post 'The Old Switcheroo'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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