Tag Archives: Interview Questions

What is the difference between an interface and abstract class?

What is the difference between an interface and abstract class?

Similarities

  • You cannot instantiate them
  • They may contain a mix of methods declared with or without an implementation

Differences

Interface abstract class
All fields are automatically public, static, and final, and all methods that you declare or define (as default methods) are public Can declare fields that are not static and final, and define public, protected, and private concrete methods
Can implement number of interfaces Can extend only one class, whether or not it is abstract,

Resources:
Abstract Classes Compared to Interfaces