chapter concludes discussion of specifically object-oriented features of the Java
language. By creating subclasses, we can inherit both variables and methods from other classes;
this encourages code reuse. Method overriding is another code reuse feature. Related to the
idea of inheritance are the concepts of abstract classes, interfaces, and inner classes. This
chapter also discusses packages and access control in Java.
5.1 Creating Subclasses
Inheritance is related to the idea of specializing an existing class. For example, we may wish
to create a class SavingsAccount that has all the characteristics ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.