Distinguish between abstract classes and interfaces

      

Distinguish between abstract classes and interfaces

  

Answers


gregory
An abstract class can never be instantiated. Its sole purpose is to be extended (subclassed).If even a
single method is abstract, the whole class must be declared abstract. However, you can put non-abstract
methods in an abstract class.
An interface is a contractor what a class can do, without saying anything about how the class will do it.
Interfaces can be implemented by any class, from any inheritance tree. An interface can have only
abstract methods. All interface methods are implicitly public and abstract. All variables defined in an
interface must be public, static, and final i.e. interfaces can declare only constants, not instance variables.
An interface can extend one or more other interfaces. An interface cannot implement another interface or
class.
gregorymasila answered the question on January 24, 2018 at 17:39


Next: Java exception handling is managed by five keywords: state and discuss the role of each of the keywords.
Previous: Explain the difference between the AWT components and the Swing Components using examples

View More Computer Science Questions and Answers | Return to Questions Index


Exams With Marking Schemes

Related Questions