Abstract class is declared using 'abstract' keyword .Interface is declared using 'interface' keyword
.
Methods:
Abstract class may contain abstract or concrete methods We can define abstract, default and static
methods in an Interface.Access modifiers
Implementation:
Abstract class can not be instantiated but can be extended.Interface can be implemented by another
class or can be extended by other interfaces Multiple inheritance.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Abstract class and Interface in Java :
Declaration:
Abstract class is declared using 'abstract' keyword .Interface is declared using 'interface' keyword .
Methods:
Abstract class may contain abstract or concrete methods We can define abstract, default and static methods in an Interface.Access modifiers
Implementation:
Abstract class can not be instantiated but can be extended.Interface can be implemented by another class or can be extended by other interfaces Multiple inheritance.
difference feild is shown below :
- Methods
- Members
- Inheritance
- Member variables
- Members visibility
- Keyword
- main() exists
- Flexibility
Example :
1. Abstract class
2. Interface