What is the difference between an interface and an abstract class in Java, and when would you use each?
Utilisateur anonyme
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.