Answer the question
In order to leave comments, you need to log in
Does it make sense to use an abstract class in Java?
Hello everyone
. Such a question: is it necessary to use abstract classes in Java, if interfaces give almost the same thing, only with additional goodies?
Answer the question
In order to leave comments, you need to log in
This is a classic interview question - what is the difference between an abstract class and an interface. The correct answer is that an abstract class allows you to inherit behavior , or implementation. Everything else is a consequence.
A great example is implementations of the standard List interface. They are most often inherited from the abstract AbsList class, which implements some basic methods.
That is, when implementations of an interface have the same behavior, it is worth thinking about an abstract ancestor.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question