Exam 1z0-829 All QuestionsBrowse all questions from this exam
Question 35

Given:

What is the result?

    Correct Answer: E

    The code includes method overloading where the method chosen by the compiler depends on the reference type of the object, not the actual object type. In this case, the reference type of `a1` is `Animal` and the reference type of `a2` is `Dog`. The method `play` that takes an `Animal` object will be called for `a1` and will print `flips`. The method `play` that takes a `Dog` object will be called for `a2` and will print `runs`. Therefore, the output will be `flipsflips`.

Discussion
SampsOption: B

B is correct

xplorerpjOption: B

B is the correct answer. Tested in Intellij