You can define an abstract method to be protected, and hence not part of the public API of the class. However, that seems like an odd design.

Another thing – instance variables. You can have inheritable instance variables in the abstract class.

Abstract class Methods can be defined at various levels down the path.

In a 100% abstract class, you can also define non constant variables that can be herited. It is not possible with interfaces.

The one case where an “100% abstract class” may be advantageous over an interface is in places where API stability is a key concern.

If you write an API where other people are expected to implement your interface you have to stick to the interface. You can’t add any methods to the interface later on because that would break all clients (you would have to work around this by implement a second interface and let your code check againt the usage with instanceof checks and provide an fallback).

One thought on “100% abstract Class vs Interface

  1. Interesting article. I would like to mention that in the upcoming release of Java 8 will close the gap between interfaces and abstract classes now that interfaces support the definition of default methods, that is, it will be possible to define implementation in the interfaces. This means, eventually, the only difference between interfaces and abstract classes will be its capacity to hold state.

Leave a reply