filmov
tv
Learn Java Programming - Polymorphism Part 2 Tutorial

Показать описание
I highly recommend watching my Introduction to Polymorphism and my Polymorphism Part 1 tutorials before continuing. The topics for this tutorial are:
The object type that a reference variable is declared as will directly affect which methods it may invoke.
We can use a technique called casting to invoke methods from subclasses that are not known to the reference variable superclass type.
An interface can be the type for a reference variable.
The instanceof operator can be used to determine if a object is a subtype of another class or interface.
Refresher · a reference variable may be assigned to an object of that specific type, or any object that is a subtype of the declared type.
The object type that a reference variable is declared as will directly affect which methods it may invoke.
We can use a technique called casting to invoke methods from subclasses that are not known to the reference variable superclass type.
An interface can be the type for a reference variable.
The instanceof operator can be used to determine if a object is a subtype of another class or interface.
Refresher · a reference variable may be assigned to an object of that specific type, or any object that is a subtype of the declared type.