- Interfaces used to implement the inheritance relationship between the non related classes that do not belongs to the same hierarchy. By using interface you can specify what a class must do but not how it does.
- Abstract classes can be used to implement the inheritance relationship between the classes that belongs to the same hierarchy.
- abstract class must have sub classes, where as interfaces have no sub classes.
- All the methods declared in the interface are abstract , where as abstract class must have one abstract method and others may be concrete.
- In abstract class keyword abstract must be used for method, where as in interface we need not use the keyword for methods.
- An abstract class can only extend one class, where as an interface can extend more than once
Find more about abstract and interfaces click here
No comments:
Post a Comment