← Antra Interview Insights

Antra·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Technical phone screen for a Software Engineer role at Antra. One question, pretty foundational OOP stuff, but they pushed on the nuances more than I expected.

Questions Asked (1)

Q1

What are the differences between an interface and an abstract class, and when would you choose one over the other?

Technical Trade-offsSystem Design
Author's notes

Started fine, talked about how interfaces only have abstract methods and constants while abstract classes can carry actual implementation and instance fields.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clearly defining both interfaces and abstract classes, highlighting their core differences in terms of inheritance, method implementation, and state. Then, discuss the trade-offs and provide scenarios where each is more appropriate, emphasizing design principles like favoring composition over inheritance and programming to interfaces.

Pro tip: Demonstrate maturity by acknowledging that modern languages like Java 8+ have blurred the lines with default methods, but the fundamental distinction remains about 'is-a' vs 'can-do' relationships and the intent of the design.

1. Define Interface

Explain that an interface is a contract specifying a set of methods that a class must implement, with no implementation details (until default methods). It supports multiple inheritance and is used to define a role or capability.

2. Define Abstract Class

Describe an abstract class as a partially implemented class that can have abstract methods (without body) and concrete methods (with body), as well as fields. It is used for sharing common code among closely related classes.

3. Compare Key Differences

Contrast them on aspects like inheritance (single vs multiple), state (fields allowed or not), method implementation (concrete methods allowed or not), and access modifiers (all methods public in interface vs any in abstract class).

4. Discuss When to Choose Which

Explain that interfaces are chosen when unrelated classes need to implement a common behavior, or when you want to define a type without implementation. Abstract classes are chosen when you have a base class with shared code and want to enforce a common structure.

5. Mention Modern Language Features

Acknowledge that in languages like Java 8+, interfaces can have default and static methods, and abstract classes can have final methods, which affects the decision. Emphasize that the choice often depends on design intent and flexibility.

Key Points to Mention

  • Interfaces support multiple inheritance, while abstract classes support single inheritance.
  • Abstract classes can have state (fields) and constructors, interfaces cannot (except static final constants).
  • Interfaces define a contract (what to do), abstract classes define a template (how to do it partially).
  • Use interfaces for decoupling and to enable polymorphism across unrelated classes; use abstract classes for code reuse and to provide a common base.
  • Design principle: 'Program to an interface, not an implementation' and 'Favor composition over inheritance'.
  • In Java 8+, interfaces can have default methods, but they cannot maintain state, so abstract classes are still needed for stateful shared behavior.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.