Easy Programming & OOP OOP Fundamentals
What is the difference between an abstract class and an interface?
Answer
Abstract class can have both abstract and concrete methods, instance variables, constructors, and supports single inheritance. Interface (traditionally) only has abstract methods and constants, supports multiple inheritance. Use abstract class for 'is-a' relationship with shared implementation; use interface for 'can-do' capabilities. In Java 8+, interfaces can have default methods. Abstract classes are partially implemented templates; interfaces define contracts. Choose based on whether you need shared state/implementation (abstract class) or pure contracts (interface).
IIT Certified
Master These Concepts with IIT Certification
175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.
Relevant for Roles
Software Engineer Backend Developer Java Developer