CSE1020 Week 9 Tutorial

Task 1: You are what you inherit... and more

Save the following Java program to your home directory: InheritanceExample.java

Compile and run the code. Notice how the instanceof operator is used to determine an object's type. Take some time to experiment with this code. Change the objects created and see how the program's output changes.