![]() |
Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
If you create a String object with keyword "new ", one object is created in heap apart from one getting created in pool. But which hashcode will be returned if hashCode() method is invoked? The hashcode of the pooled object or the heap object? I shall write a small piece of code for clarity. String s1="Hello"; System.out.println(if(s1==s2)); String s3 = new String("Hello"); My understanding is when you apply == it is the hash codes getting copared. Please tell me what is happening here.
Replies:
|
Sponsored Links
|