1z0-829 Exam QuestionsBrowse all questions from this exam

1z0-829 Exam - Question 35


Given:

What is the result?

Show Answer
Correct Answer: BE

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

2 comments
Sign in to comment
SampsOption: B
Feb 21, 2024

B is correct

xplorerpjOption: B
Jun 25, 2024

B is the correct answer. Tested in Intellij