Inheritance
A class can inherit properties and methods from a super class (sometimes called a "parent class") with the extends
keyword.
Notice that instanceof
considers an instance of Dog
to be both a Dog
and an Animal
. There may be multiple classes that each extend
another one, which make up a hierarchy called an inheritance chain.