Java Genesis

Hints for Chapter 8: Inheritance

Problem 14: working with abstract classes

To test the type of the object referenced by accountArray[i], say, we need a Boolean expression such as

(accountArray[i] instanceof SilverCreditCard)
        && !(accountArray[i] instanceof GoldCreditCard)

Try this before looking at the next hint.

Next Hint