title: what is difference between integer a = 5 and new Integer(5)?
body: <p>if i write below code(in java): </p>
  
  <pre><code>Integer a =new Integer(5);
  Integer b=new Integer(5);
  if(a==b){
    System.out.println("In ==");
  }
  if(a.equals(b)){
   System.out.println("In equals");
  }
  </code></pre>
  
  <p>My output is: "In equals"
  But if i change first and second line to -></p>
  
  <pre><code>Integer a =5;
  Integer b=5;
  </code></pre>
  
  <p>then my o/p is: </p>
  
  <pre><code>In == 
  In equals
  </code></pre>
  
  <p>So what is difference in creating a Integer object? How it gets created when we do <code>Integer a =5</code>?</p>
  
  <p>Does it mean that a and b object refer to same object, if i create <code>Integer a=5</code> and creates another object <code>Integer b=5</code> ?</p>