Results 1 to 1 of 1
-
Switch statement to display the name of the month
Assuming that month is int and contains the month number, following piece of code will print the name of the month.
Java Code:switch (month) { case 1: System.out.print("January"); break; case 2: System.out.print("February"); break; case 3: System.out.print("March"); break; case 4: System.out.print("April"); break; case 5: System.out.print("May"); break; case 6: System.out.print("June"); break; case 7: System.out.print("July"); break; case 8: System.out.print("August"); break; case 9: System.out.print("September"); break; case 10: System.out.print("October"); break; case 11: System.out.print("November"); break; case 12: System.out.print("December"); }
Similar Threads
-
Method in a Switch Statement
By cart1443 in forum New To JavaReplies: 6Last Post: 03-14-2008, 03:48 AM -
Switch Statement Help
By bluegreen7hi in forum New To JavaReplies: 6Last Post: 02-06-2008, 05:16 AM -
Help with gigantamous switch statement
By trill in forum New To JavaReplies: 2Last Post: 08-06-2007, 08:11 AM -
Problem with a switch statement in Java
By baltimore in forum New To JavaReplies: 2Last Post: 08-02-2007, 04:43 AM -
Statement or Prepared Statement ?
By paty in forum JDBCReplies: 3Last Post: 08-01-2007, 04:45 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks