juniorOOP

What is an interface in OOP?

Updated May 17, 2026

Short answer

An interface defines a contract that classes must implement.

Deep explanation

It specifies method signatures without implementation, enforcing structure across classes.

Real-world example

Payment gateway interfaces ensuring consistent methods.

Common mistakes

  • Adding implementation inside interfaces.

Follow-up questions

  • Interface vs abstract class?
  • Can a class implement multiple interfaces?

More OOP interview questions

View all →