Does interfaces and abstract classes in Java extend base Object class? Logical answer which I can think of is no, but if interface does not extend Object class, then can please someone explain me the below code:
interface A {
@Override
public int hashCode();
@Override
public String toString();
}
In above case, A interface is the new interface declared. Yet, no class is implementing it. Then how come the methods from Object class visible in the interface?
If it doesn't extend Object class, then why I can't declare following method in the interface:
public Class getClass();
When I tried to declare this method in the interface, it says that it can't override this method, inherited from Object class, as it is declared as final method in Object class.