CSS font stacks & developer FAQs with Web standards
Site navigation below

One of hundreds of answers available with our premium content service.

Part answer

A: One of the design principles of Java inheritance is to create superclass methods that can be used by one or more subclasses, this avoids duplication of code and makes it easier to amend. The same principle holds with abstract classes that are fulfilled by numerous subclasses.

One useful technique with abstract classes is that a concrete method may be defined in anticipation of abstract methods being fulfilled in its subclasses. In the example below the AbstractShape class has a concrete printArea() method that calls the abstract getArea() method. Subclasses inherit the printArea() method and must implement the getArea() method to stand as concrete classes.

… full answer hidden

Click for full answers

Premium members click below for full answer
What's the use of concrete methods in abstract classes?

Home · Web fonts · Font stacks · FAQs · Java · CSS · Javascript · HTML · Site manager