Domanda di colloquio di Tata Consultancy Services

Explain the difference between an interface and an abstract class in Java and when you would use each one.

Risposta di colloquio

Anonimo

5 mar 2026

I explained that an interface defines a contract that a class must implement, while an abstract class can contain both abstract and concrete methods. I also mentioned that a class can implement multiple interfaces but can only extend one abstract class.