-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonthsOfTheYearEnums.java
More file actions
51 lines (47 loc) · 1.58 KB
/
Copy pathMonthsOfTheYearEnums.java
File metadata and controls
51 lines (47 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
public class MonthsOfTheYearEnums{
public enum Month {
JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER
}
public static void main(String[] args){
String mess1 = "This is the month of ";
Month now = Month.SEPTEMBER;
switch(now){
case JANUARY:
System.out.println(mess1 + "January.");
break;
case FEBRUARY:
System.out.println(mess1 + "February.");
break;
case MARCH:
System.out.println(mess1 + "March.");
break;
case APRIL:
System.out.println(mess1 + "April.");
break;
case MAY:
System.out.println(mess1 + "May.");
break;
case JUNE:
System.out.println(mess1 + "June.");
break;
case JULY:
System.out.println(mess1 + "July.");
break;
case AUGUST:
System.out.println(mess1 + "August.");
break;
case SEPTEMBER:
System.out.println(mess1 + "September.");
break;
case OCTOBER:
System.out.println(mess1 + "October.");
break;
case NOVEMBER:
System.out.println(mess1 + "November.");
break;
case DECEMBER:
System.out.println(mess1 + "December");
break;
}
}
}