Menu
Question Index
...

What will be the output of the following program?

class DetermineGroup
{
    public static void main(String s[])
    {
        boolean male = false;
        int age = 30;
        
        if( male )
            if( age < 20 )
                System.out.println("Boy");
            else
                System.out.println("Man");
        else
            if( age < 20 )
                System.out.println("Girl");
            else
                System.out.println("Woman");
    }
}


Girl
Woman
Boy
Man
Compilation Errors

Doubts

Problems

Topic: Nested if Statements In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App