//对象的identityHashCode()相同,一定是相等的对象
 public class IdentityHashCodeDemo {
 
 
 
public static void main(String[] args) {
 
 
String str1 = new String("Hello World");
 
String str2 = new String("Hello World");
 
System.out.println(str1.equals(str2));//true
 
System.out.println(str1.hashCode()==str2.hashCode());//true
 
System.out.println(System.identityHashCode(str1)+"====="+System.identityHashCode(str2));//值不同
 
 
String str3="Java学习之法";
 
String str4="Java学习之法";
 
System.out.println(System.identityHashCode(str3)+"====="+System.identityHashCode(str4));//值相同
 
}
 }