| |
5.7.4.Use if/else in a nested fashion, refining conditions to more specific, or narrower, tests at each point. |
|
public class MainClass {
public static void main(String[] argv) {
int hours = 3;
if (hours > 1) {
System.out.println("evening");
} else if (hours > 2) {
System.out.println("afternoon");
} else {
System.out.println("morning");
}
}
}
|
|
evening |
|