+2 votes
in Java Interview Question by
public class MainClass
public static void main(String[] args)
Integer i = 130;

Integer j = 130;

System.out.println(i == j);

Now the output comes as false, can you pls explain why ?

1 Answer

+1 vote
when you declare using "Integer" class , instead of variable- an object is created an object comparison with == gives false.

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated