Each object has a unique hash value which you can treat as unique ID for that object.
String abc = new String("Australia");
System.out.println("Hash code for String object: " + abc.hashCode());
Student obj = new Student();
System.out.println("Hash code for Student object: " + obj.hashCode());
Output:
Hash code for String object: -1357076128
Hash code for Student object: 26022015