What is the difference between an abstract class and an interface in Java 8+?

Java Associate Medium

Java Associate — Medium

What is the difference between an abstract class and an interface in Java 8+?

Key points

  • Abstract classes support constructors, variables, and methods
  • Interfaces can only have default/static methods
  • Abstract classes can provide more implementation details
  • Interfaces are used for defining contracts
  • Both are important in Java OOP design

Ready to go further?

Related questions