nerdexam
Oracle

1Z0-829 · Question #22

1Z0-829 Question #22: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-829 to reveal the answer and full explanation for question #22. The question stem and answer options stay visible for context.

Java Object-Oriented Approach

Question

Given: public class Test { static interface Animal { } static class Dog implements Animal { } private static void play(Animal a) { System.out.print("flips"); } private static void play(Dog d) { System.out.print("runs"); } public static void main(String[] args) { Animal a1 = new Dog(); play(a1); play(a2); } } What is the result?

Options

  • Aflipsflips
  • BCompilation fails
  • Cflipsruns
  • Drunsflips
  • Erunsruns

Unlock 1Z0-829 to see the answer

You've previewed enough free 1Z0-829 questions. Unlock 1Z0-829 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Topics

#method overloading#variable declaration#compile-time type resolution#undefined variable
Full 1Z0-829 Practice