Posted in Core Java

Java – Abstract class vs Interface

 

Abstract class

Interface

Have abstract & non-abstract methods Only abstract methods
Not support multiple inheritance Supports multiple inheritance
Can have final/non-final/statis/non-static variables Only final & static variables
Can have:

·         static methods

·         main method

·         constructor

Cannot have

 

 

 

Can provide implementation of interface Cannot provide implementation of abstract class
When we want to add new methods When we want to have multiple inheritance
We extend it We implement it