Home > DeveloperSection > Forums > Difference between Abstract class and interface in java
Royce Roy
Royce Roy

Total Post:134

Points:938
Posted on    April-15-2015 12:05 AM

 Java Java  Abstract Class  Interface 
Ratings:


 1 Reply(s)
 407  View(s)
Rate this:
What is the difference between abstract classes and interfaces in java,both look very similar to me


Mayank Tripathi
Mayank Tripathi

Total Post:397

Points:3117
Posted on    April-15-2015 12:43 AM

Abstract classes:
1)An abstract class can have method body (non-abstract methods).
2)An abstract class can have instance variables. .
3)An abstract class can have constructor.
4)An abstract class can have static methods.
5)You can extends one abstract class.

Interfaces
1)Interface have only abstract methods.
2)An interface cannot have instance variables
3)Interface cannot have constructor.
4)Interface cannot have static methods.
5)You can implement multiple interfaces.

Don't want to miss updates? Please click the below button!

Follow MindStick