Page 1251 - AP Computer Science A, 7th edition
P. 1251
31. (C) A compile-time error will occur for both tests I and II because at compile time the types of code and num are both ThreeDigitInteger, and the class ThreeDigitInteger does not have an isValid method. To avoid this error, the code object must be cast to ThreeDigitCode, its actual type. Note that if you try to cast num to ThreeDigitCode, you’ll get a run- t im e error (ClassCastException) bec aus e num is not an instance of ThreeDigitCode.