how hashCode () behaves in java
<p>Today i was trying the below code and was expecting the output different for both the sysout.</p>

<pre><code>public class StringDemo {


    public static void main(String[] args) {
        String s1 = new String("Hi");
        String s2 = new String("Hi");       
        System.out.println(s1.hashCode());
        System.out.println(s2.hashCode());
    }

}
</code></pre>

<p>But i'm getting the same value. Can anybody please explain me how the thing is working?</p>

<p>Thanks,
Sourav</p>
