Question d’entretien chez ServiceNow

What is the difference between an interface and an abstract class in Java, and when would you use each?

Réponse à la question d'entretien

Utilisateur anonyme

22 juil. 2025

I explained that an interface is a contract for what a class can do, without implementation, while an abstract class can have both abstract and concrete methods. I mentioned that I would use interfaces for multiple inheritance and abstract classes when I want to share common code among related classes.