Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum Mood {
- HAPPY,
- SAD,
- ANGRY
- }
- Mood myMood = Mood.Happy;
- switch(myMood){
- case HAPPY:
- System.out.println("Happy!");
- case SAD:
- System.out.println("SAD :(");
- break;
- case ANGRY:
- System.out.println("*F!@#");
- break;
- default:
- System.out.println("AAAAAAA");
- break;
- }
- // Because there is no break statement in the HAPPY case, this program will print out "Happy!" and "SAD :("
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement