1.

What are the key differences between an abstract class and an interface.

Answer»

The key DIFFERENCES between an abstract class and an interface are as follows:

COMPARISON ParameterAbstract ClassInterface
UsageAbstract Classes are extended.Interfaces are implemented.
Final VariablesAbstract classes can or cannot contain final variables and non-final variablesIn interfaces, all variables are final by default.
Accessibility of DATA MembersAbstract classes can be PRIVATE, public, etc. Interfaces are public by default.
METHODSAbstract, as well as other types of methods, are allowed in abstract classes.Only abstract methods can be present in an interface.
ImplementationAbstract classes cannot be implemented.Interfaces can be implemented.


Discussion

No Comment Found