Java provides classes a choice to to implement an interface completely or just partially. But, opting to implement an interface renders a class incomplete. It means that the class that implements an interface incompletely, must be declared Abstract. Any class that extends such class, must implement remaining methods of the interface or should declare themselves as Abstract too.
Showing posts with label Abstract Class in Java. Show all posts
Showing posts with label Abstract Class in Java. Show all posts
Abstract Class Illustrated
An abstract class is the one having an abstract method in its definition. Abstract class puts a restriction that subclass must implement its own version of abstract methods. Programmer does not has the freedom to create object of an Abstract class. One can not declare abstract constructors or abstract static methods. One can not instantiate an Abstract class object with new operator. However, Java provides us the freedom to create an reference of Abstract class type. This reference can be used to store the reference of subclass object references.
Subscribe to:
Posts (Atom)