javaclassinheritancemethodsabstract

Defining an abstract class without any abstract methods


Can I define an abstract class without adding an abstract method?


Solution

  • Of course.

    Declaring a class abstract only means that you don't allow it to be instantiated on its own.

    Declaring a method abstract means that subclasses have to provide an implementation for that method.

    The two are separate concepts, though obviously you can't have an abstract method in a non-abstract class. You can even have abstract classes with final methods but never the other way around.