Menu
Question Index
...

What will be the output of the following program?

class Animals
{
    public static void main(String [] args)
    {
        boolean rabbit = true;
        boolean donkey = false;
        boolean leporidae = true;

        if (rabbit & donkey | donkey & leporidae | donkey)
            System.out.print("DOG ");

        if (rabbit & donkey | donkey & leporidae | donkey | rabbit)
            System.out.println("CAT ");
    }
}


DOG
CAT
DOG CAT
The program executes but there is no output.
Compilation Error

Doubts

Problems

Topic: if Condition 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