Chapter 8Class Design

OCP EXAM OBJECTIVES COVERED IN THIS CHAPTER:

  • Creating and Using Methods
    • Create methods and constructors with arguments and return values
  • Reusing Implementations Through Inheritance
    • Create and use subclasses and superclasses
    • Enable polymorphism by overriding methods
    • Utilize polymorphism to cast and call methods, differentiating object type versus reference type
    • Distinguish overloading, overriding, and hiding

In Chapter 2, “Java Building Blocks,” we introduced the basic definition for a class in Java. In Chapter 7, “Methods and Encapsulation,” we delved into methods and modifiers and showed how you can use them to build more structured classes. In this chapter, we’ll take things one step further and show how class ...

Get OCP Oracle Certified Professional Java SE 11 Developer Complete Study Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.