In the last tutorials two tutorials, we learned about abstract class and interface. In this tutorial, we will learn what is the difference between Abstract class and Interface.
|An abstract class can have both abstract and non-abstract methods.||But an Interface can have only abstract methods.|
|We can not perform multiple inheritances in the abstract class.||But in the case of Interface we can perform multiple inheritance.|
|An Abstract class can have both final or non-final and static or non-static variables.||But Interface can has only static and final variables.|
|An abstract class can have class members like private, protected, etc.||But in case of interface all members are public by default.|
|We can implement an interface in an abstract class.||But in an Interface can’t implement an abstract class.|
|The abstract keyword is used to declare an abstract class.||The interface keyword is used to declare an interface.|
|To inherit the abstract class in our class we use “extends” keyword.||To inherit in interface in our class we use “implements” keyword.|