What is difference between Abstract class and Interface in java?


There are following difference between abstract class and interface:
Abstract Class
Interface
     1.     Abstract class can contain instance and static variables
   1.     Interface can contain only static variables
    2.     Abstract class can contain constructor
   2.     Interface can’t contain constructor
    3.     Abstract class contain instance block and static block
    3.     Interface can’t contain both instance and static block
    4.     Abstract class can contain concrete method and abstract method
4.  Interface contain only abstract method
    5.     Multiple inheritance is not allowed through class
5 . Multiple inheritance is possible through interface  

These above are basic difference between abstract class and interface.

0 comments :

Post a Comment