What will be the output of the following program?
Correct Answer : B
DetermineGroup has a
main method. The execution of any program starts from
main are two variables
male of type
integer type which are declared and initialized to
30 respectively. The first
if (outer if) is encountered and condition is checked.
false. So if is not executed and control goes to corresponding else (line 13). Inside
if is again checked. As
age < 20 is
false, the display statement below
if is not executed and control goes to corresponding
else (line 16) and display statement prints Woman.
Topic: Nested if Statements In Java