Choose between a Java Interface and an Abstract Class

Quick Overview

Compare Java interfaces and abstract classes through contracts, state, constructors, and inheritance limits. Use concrete design examples to choose between implementation inheritance and composition.

Choose between a Java Interface and an Abstract Class

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Technical Screen

What is an abstract class in Java, what is an interface, and how would you choose between them? Explain the inheritance constraints and the kinds of implementation each can provide. ### What a Strong Answer Covers Discuss instantiation, shared instance state, constructors, abstract and concrete behavior, and multiple interface implementation. Avoid treating an interface as a class or claiming that interfaces can never contain method bodies. ### Follow-up Questions - When is composition a better choice than adding a shared superclass? - How should a class resolve conflicting inherited interface defaults?

Overview: Compare Java interfaces and abstract classes through contracts, state, constructors, and inheritance limits. Use concrete design examples to choose between implementation inheritance and composition.

Jan 14, 2026
mediumSoftware EngineerTechnical ScreenSoftware Engineering Fundamentals
0
0

What is an abstract class in Java, what is an interface, and how would you choose between them? Explain the inheritance constraints and the kinds of implementation each can provide.

What a Strong Answer Covers Guidance

Discuss instantiation, shared instance state, constructors, abstract and concrete behavior, and multiple interface implementation. Avoid treating an interface as a class or claiming that interfaces can never contain method bodies.

Follow-up Questions Guidance

  • When is composition a better choice than adding a shared superclass?
  • How should a class resolve conflicting inherited interface defaults?