You did not override toString
and hashValue
, so the implementations from Object
are used.
toString()
returns a String consisting of the class name (RefDem
) and the memory location in hexadecimal form (1e5e2c3
) seperated by “@”.
"d :" + d
is equivalent to "d :" + d.toString()
so you get "d :RefDem@1e5e2c3"
The hashCode
implementation of Object returns the memory location of the Object (as int) which is 31843011
(note that 31843011 == 0x1E5E2C3
)
solved what is difference between object value and object hashCode value [closed]