Let’s learn difference between abstract class and interface in java.
Difference between abstract class and interface in java
Here’s the difference between abstract class and interface.
|an abstract class can have protected, private etc. as access modifiers for class members.||members of interface are public by default.|
|abstract class can have static, final, static, non-static and non final variables.||interface only have static and final variables.|
|abstract class do not support multiple inheritance.||interface support multiple inheritance in java.|
|abstract class is declared using “abstract” keyword.||interface keyword is used to declare interface.|
|abstract class can extend another java class and implement multiple interfaces.||interface can only extend another interface.|
|cannot be instantiated. can be subclassed.||absolutely abstract; cannot be instantiated|
|abstract class can have non-abstract and abstract methods.||interface can have only abstract methods. From Java 8 interface can have static and default methods.|
|achieves partial abstraction.||achieves full abstraction.|
Also read – java overview