Difference between abstract class and interface in java

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.

Abstract classInterface
An abstract class can have protected, private, public and default as access modifiers for class members.All methods and variables in interface are always public.
In Abstract class we can declare fields that are not static and final, and define public, protected and private methods.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 class and can implement multiple interfaces.An Interface can extend any number of interfaces.
Abstract class can be extended using “extends” keyword.Interface can be implemented using “implements” keyword.
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