As per my understanding from some books on Java, interfaces cannot extend classes.
But all interfaces do inherit methods from Object class. Why is this so?
If Interface not extend from Object class. So how this code work it?
interface A
{
public boolean equals(Object o);
}
class InterfaceAndObjectClass
{
public static void main(String[] args)
{
A a = null;
a.equals(null);
a.hashCode();
a.toString();
}
}
Please help me to explain how access the Object class method in Interface.