title: Java - hashCode() in Integer variable returning the assigned value
body: <p>Hi I'm just trying to understand some basics concepts like <code>immutable</code> in <code>java</code> programming. So I came across this coding.</p>
  
  <pre><code>public class IntImmutable {
    public static void main(String[] args) {
        Integer i = 10;
        System.out.println("value = "+i " hashCode = "+i.hashCode())
        i+=9;
        System.out.println("value = "+i " hashCode = "+i.hashCode())
    }
  } 
  </code></pre>
  
  <p>Here I understand the code concept <code>immutable</code> but the value <code>hashCode()</code> returning is weird. Here is the output</p>
  
  <pre><code>value = 10 hashCode = 10
  value = 19 hashCode = 19
  </code></pre>
  
  <p>If you notice the value and <code>hashCode</code> value is same, is it the expected 
  behavior, My understand is <code>hashCode</code> would return some <code>memory reference value</code>.</p>