Methods, Interfaces, Records, and Their Relationships
In Java, how we define and organize our code is the cornerstone of the language. In this chapter, we will begin by examining the role that a method plays in Java. From here, we will examine the relationships afforded by inheritance and interface. The immutable record
class is next up. Polymorphism, the ability to use objects in a hierarchy of classes, as it applies to inheritance and interface, is covered next. We will finish the chapter by looking at the relationships between objects and how they can call upon methods in other objects.
We will learn about the following topics in this chapter:
- Understanding methods
- Understanding inheritance
- Understanding the class interface
- Understanding the
record
class - Understanding polymorphism
- Understanding composition in classes
By understanding all the components and relationships available in Java, you’ll be able to read or write Java code.
...