8.2. Answers to mock exam questions

This section contains answers to all the mock exam questions in section 8.1. Also, each question is preceded by the exam objectives that the question is based on.

[7.2] Develop code that demonstrates the use of polymorphism; including overriding and object type versus reference type

[7.3] Determine when casting is necessary

[8.5] “Recognize common exception classes (such as NullPointerException, ArithmeticException, ArrayIndexOutOfBoundsException, ClassCastException)”

ME-Q1)

Given the following definition of the classes Animal, Lion, and Jumpable, select the correct combinations of assignments of a variable that don’t result in compilation errors ...

Get OCA Java SE 8 Programmer I Certification Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.