Menu
Question Index
...

What will be the output of the following program?

class PrintRelation
{
    public static void main(String s[])
    {
        int a = 7 * 3 + 6 / 2 - 5;
        int b = 21 - 8 + a % 3 * 11;

        if(a < b)
        {
            System.out.println("A is less than B");
        }

        if(a = b)
        {
            System.out.println("A is equal to B");
        }

        if(a > b)
        {
            System.out.println("A is greater than B");
        }
    }
}


A is less than B
A is equal to B
A is greater than B
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