title: why int can't be compared to null but Integer can be compared to null
body: <p>Though this has been discussed in detail in various forums including <code>SO</code> and I have read most of the replies of the experts, But below is the problem is confusing me.</p>
  
  <p>I have few <code>integer</code> variables and my requirement is to check <code>null</code> before executing few statements. So first I have declared as <code>int (I don't have knowledge on int and Integer)</code>. </p>
  
  <pre><code>int a,b,c;
  if(a == null) {
      //code here
  }
  </code></pre>
  
  <p>But complier is not allowing me to declare like this.</p>
  
  <p>After searching in google, experts advised me to use <code>Integer</code> instead of <code>int</code> and when I changed like the code below</p>
  
  <pre><code>Integer a,b,c;
  if(a == null) {
     //code here
  }
  </code></pre>
  
  <p>This is fine with the compiler as <code>Integer</code> is defined as <code>Object</code> in java and <code>int</code> is not.</p>
  
  <p>Now my code has become some declarations with <code>int</code> and some with <code>Integer</code>. </p>
  
  <p>Can anyone suggest if declaring <code>Integer</code> will give the same result as <code>int</code> also can I change all my declarations to <code>Integer</code>.</p>
  
  <p>Thanks for your time.</p>