If an interface does not extends Object class then why the interface references shows toString(), hashCode() and other Object’s method.
Because that's the way the language is designed. Any class implementing the interface will definitely have Object
as an ultimate ancestor, so at execution time, those methods will definitely be available.
This is specified in JLS 9.2:
If an interface has no direct superinterfaces, then the interface implicitly declares a public abstract member method
m
with signatures
, return typer
, and throws clauset
corresponding to each public instance methodm
with signatures
, return typer
, and throws clauset
declared inObject
, unless an abstract method with the same signature, same return type, and a compatible throws clause is explicitly declared by the interface.
See more on this question at Stackoverflow