Abstract vs Interface
1.Abstract class is consists of both defined and undefined methods where as In Interface is consists of only undefined method.
2.Abstract class does not support Multiple Inheritance but In Interface supports Multiple Inheritance.
3.Abstract methods and data members are default by default scope but In Interface data members and methods are default by public scope.
4.When Overriding Abstract methods in child class they do not have restriction to be made public but In Interface methods in child class they should be made public otherwise it results in compile time error
5.Class can inherit the abstract feature by using extends keyword.but In Interface by using implements keyword
6.Abstract class can have both variable and constant but Interface have only constants.
7.Abstract class has constructor but Interface cannot have constructor.
8.In Abstract class the data members are not final by default but In Interface data members are final by default.
9.In Abstract class data members are may be initialised or may not be.But Interface data members should be initialised.
10.In Abstract class can have all type of modifier like private,protected,public and default scope allowed in data members but In Interface the only public by default.
Comments
Post a Comment