I have this code
class A
{
public static void main(String reds[])
{
A ob=new A();
System.out.println("Object "+ob);
System.out.println("HashCode "+ob.hashCode());
}
}
Output is: Output image
The output for above code gives different value most of the time. Also, the below link mentions that printing a reference variable prints ClassName@hashcode.
printing reference variable is not printing the object's address
However, the output for printing reference varibale differs from hashCode().What is actually happening here?
Just wanted to clear my concepts of hashcode in java.