Defining an abstract class without any abstract methods

VisaMasterCard picture VisaMasterCard · Jan 27, 2011 · Viewed 112.4k times · Source

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

Answer

biziclop picture biziclop · Jan 27, 2011

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.