Does abstract class extend Object?

As already mentioned by others, class A overrides those methods in Object by declaring them again as abstract, so it forces subclasses to implement them.

As a clarification for your situation try defining A as follows:

abstract class A {
    //public abstract int hashCode();
    //public abstract boolean equals(Object obj);
}

class C extends A {
    // no compile error because no abstract methods have to be overridden
}

In this case both A and C inherit the implementation of those methods from Object and no compilation error occurs.


It results in a compile error because by definition abstract functions must be implemented downstream in the inheritance chain. You've created the requirement they must be implemented in a subclass of A.

Class C does not implement those methods, so compilation failure.

Object is a superclass of abstract classes... but it's not a subclass, and subclasses are responsible for implementing abstract functions.

In contrast, if a class implements an interface, the implementation can live anywhere in that class's inheritance hierarchy. It's less common to have those implementations lie in a superclass, because you'd generally declare the interface in the superclass.

There are use cases where you might not, like degenerate/poor design, or examples like this while poking around language features.