Menu
Question Index
...

What will be the output of the following program?

public class Equals
{
    public static void main(String[] args)
    {
        int x = 3 - 2;
        int y = 1;
        if (x.equals(y))
            System.out.println("Not equal");
        else
            System.out.println("Equal");
    }
}


Not equal
Equal
Compilation Error
Runtime Error

Doubts

Problems

Topic: Java equals method vs == Operator

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App