Comparing 2 Integer values are giving different output
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/3351837/java-question-about-autoboxing-and-object-equality-identity">Java question about autoboxing and object equality / identity</a>  </p>
</blockquote>



<pre><code>Integer i1 = 10;
Integer i2 = 10;
Integer i3 = 210;
Integer i4 = 210;

if(i1 ==i2){
      System.out.println("True");
}else{
      System.out.println("False");
}
if(i3==i4){
       System.out.println("True");
}else{
       System.out.println("False");
}
if(Integer.valueOf(10) ==Integer.valueOf(10)){
       System.out.println("True");
}else{
      System.out.println("False");
}
if(Integer.valueOf(210) ==Integer.valueOf(210)){
       System.out.println("True");
}else{
       System.out.println("False");
}
</code></pre>

<p>The answer is</p>

<p>True</p>

<p>False</p>

<p>True</p>

<p>False</p>

<p>Why it is giving false for 2 and 4 condition ?</p>
