From the course: Java SE 21 Developer (1Z0-830) Cert Prep

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Learning objectives

Learning objectives

- In this lesson, we'll be investigating aspects and consequences of polymorphism and casting. We'll start by differentiating object and reference type, and clarifying how the two can differ. That context will set us up nicely for a discussion of the instance of operator and the patent matching capabilities it has. Next, we'll investigate the traditional mechanism of casting, including cast that the compiler allows versus those it rejects. Virtual method indication is the topic that follows that, and we'll investigate the behavior that results from a given instance method call, and what calls are permitted. We'll also check in on the effect of the at override annotation. This lesson closes with an investigation of how the Liskov substitution principle guides Java's rule about co-variant returns from overriding methods.

Contents