+1 vote
in JAVA by
What are difference between abstract class and interface in Java?

2 Answers

0 votes
by

There are multiple differences between abstract class and interface in Java, but the most important one is Java's restriction on allowing a class to extend just one class but allows it to implement multiple interfaces. An abstract class is good to define default behavior for a family of class, but the interface is good to define Type which is later used to leverage Polymorphism. Please check the answer for a more thorough discussion of this question.

0 votes
by
An abstract class is a class that cannot be instantiated and provides a common interface for its subclasses, while an interface is a blueprint for classes and defines a set of methods that a class must implement. An abstract class can contain both abstract and concrete methods, while an interface can only contain abstract methods.

Related questions

+1 vote
asked Jan 27, 2020 in JAVA by rahuljain1
+1 vote
asked Apr 15, 2021 in JAVA by SakshiSharma
...