Tuesday 17 January 2017

Interface VS Abstract class

Interface VS Abstract class
S.No
Abstract
Interface
1
May or maynot contain   constructor
Cannot contain constructor
2
May or maynot have abstract methods
All methods are public and abstract by default
3
May or maynot contain   static/final fields
All fields are public, static and final by default
4
Abstract class is extended by a class
Interface is implemented by a class
5
Cannot
An interface can extend multiple interfaces
6
Keyword is Abstract
Keyword is Interface

An interface can only extend another Interface; an interface can only be implemented by a class.


No comments:

Post a Comment