Abstract Classes and Methods – Object-Oriented Programming
5.4 Abstract Classes and Methods The keyword abstract is used in the following contexts in Java: Abstract Classes A concrete class is one that defines, by virtue of its public methods, a contract for services it guarantees its clients and provides the implementation for all the methods necessary to fulfill that contract. Clients can readily instantiate a concrete class and use its objects. In certain cases, a class might want to define the contract for the services, but only provide partial implementation for its contract. Such a design decision might be necessary if the abstraction the class represents is so general that certain aspects need to be specialized by subclasses to be of practical use, but at the same time guarantee that these will be implemented by the subclasses. This design strategy can be implemented by using abstract classes. Clients cannot instantiate an abstract class, but now its concrete subclasses…