home *** CD-ROM | disk | FTP | other *** search
/ Borland JBuilder 6 / jbuilder6.iso / Documents / JAVA Programming / examples / 06 / SwitchSeason.java < prev    next >
Encoding:
Java Source  |  2000-09-08  |  572 b   |  30 lines

  1. class SwitchSeason { public static void main(String args[]) { 
  2. int month = 4;
  3. String season;
  4. switch (month) { 
  5. case 12: // FALLSTHROUGH 
  6. case 1: // FALLSTHROUGH
  7. case 2:
  8. season = "Winter";
  9. break;
  10. case 3: // FALLSTHROUGH 
  11. case 4: // FALLSTHROUGH 
  12. case 5:
  13. season = "Spring";
  14. break;
  15. case 6: // FALLSTHROUGH 
  16. case 7: // FALLSTHROUGH 
  17. case 8:
  18. season = "Summer";
  19. break;
  20. case 9: // FALLSTHROUGH 
  21. case 10: // FALLSTHROUGH 
  22. case 11:
  23. season = "Autumn";
  24. break;
  25. default:
  26. season = "Bogus Month";
  27. }
  28. System.out.println("April is in the " +    season +    ".");
  29. } }
  30.