A. Introduction
In the example of writing a program to find the number of days in a month, we need to judge if a year is a leap year and if a month is a 30-day month or not. This can be done through branching using if... else...
B. First we need to read the data and set some variables:
Then we can decide based on the input:
Notice
If there is only 1 statement in the block after either "if" or "else", { } is optional but we recommend to use { } always.
When multiple if... else ... are nested, "else" is always matched to the nearest "if" regardless of indentation.
C. Try
R5.1-R5.5 on page 220 of chapter 5 of the Big Java Object