Hey there! any question in your mind? Ask It Now!.

Popular Categories

why 130 == 130 returns false in java

+2 votes
asked in Java Interview Question by anonymous
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
answered by anonymous
when you declare using "Integer" class , instead of variable- an object is created an object comparison with == gives false.

Related Questions

0 votes
1 answer 218 views

Not a Member yet?

Ask to Folks Login

My Account
333 Folks are online
2 members and 331 guest online
Your feedback is highly appreciated