What is the Difference Between Abstract Class and Interface in Java?

Both abstract class and interface are the major components of Java language. Both these techniques are used for hiding the implementing part and exposing the functionality part of a program to its users. But both of these are different from one another:

Abstract ClassInterface
Only a single abstract class be get inherited by a class.A class can inherit several interfaces.
Abstract class provide the complete code or simply the details which need to be overridden.Interface provides the signature rather than the code.
It is comparatively faster than the interface.It requires more execution time and hence slower than an abstract class.
There you can provide the access specifier to functions and properties of the abstract class.There cannot be any access specifier to the interface, and hence everything is taken as a public.
You can define fields and constants for abstract class.You cannot define any fields within the interface.

Subscribe Updates via Email
