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

Popular Categories





why 130 == 130 returns false in java

+2 votes
204 views
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 60 views

Not a Member yet?

Ask to Folks Login

My Account
155 Folks are online
0 members and 155 guest online
Your feedback is highly appreciated