|
Answer» Abstract CLASS and Interface both are used for ABSTRACTION which is HIDING the background details and representing only the essential features. But there are major DIFFERENCES between abstract classes and interfaces. These are given as follows: Parameter
| Abstract Classes
| Interfaces
|
|---|
Instance Variables
| Can have instance variables
| Cannot have instance variables
| Visibility
| Can have any visibility:public, private or protected
| Have either public visibility or no visibility
| NATURE of methods
| Can have both abstract as well as non-abstract methods
| Only have abstract methods
| Constructors
| Can have constructors
| Cannot have constructors
| Association
| Can be extended by using keywords ‘extends’
| Can be implemented by using keyword ‘implements’
| Nature of Association by Java class
| A Java class can extend only one abstract class
| A Java class can implement multiple interfaces
| Provision of code
| Can provide complete code
| Just provide the signature/prototype
|
|