Kelvin Okornoe wrote:What I know is that, the if condition execute the statement on Line 8 when it evaluates to true and the statement on Line 9 will always execute regardless the condition evaluates to either true or false.
I don't know what am missing here.
What you know is wrong! No code will be executed because you get a compiler error due to
line9. It would have been true if you remove the
else block (lines 10-12) from the code. If you want the current code to compile successfully, you have two options: either wrap lines 8 & 9 within a pair of curly braces or remove
line8/
line9.