-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIfElse.java
More file actions
27 lines (19 loc) · 533 Bytes
/
IfElse.java
File metadata and controls
27 lines (19 loc) · 533 Bytes
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
package control;
class IfElse {
public static void main(String args[]) {
int month = 4; // April
String season;
if (month == 12 || month == 1 || month == 2) {
season = "Winter";
} else if (month == 3 || month == 4 || month == 5) {
season = "Spring";
} else if (month == 6 || month == 7 || month == 8) {
season = "Summer";
} else if (month == 9 || month == 10 || month == 11) {
season = "Autumn";
} else {
season = "Bogus Month";
}
System.out.println("April is in the " + season + ".");
}
}