Courseiva
Object-Oriented ProgramminghardMultiple ChoiceObjective-mapped

Polymorphism in Java

Which of the following best demonstrates polymorphism in Java?

Quick Answer

The detail that makes an interface reference calling a method the clearest demonstration of polymorphism is that the decision about which actual implementation runs is made at runtime, based on the real class of the object behind the reference, rather than at compile time based on the reference's declared type. Declaring a variable with an interface type and assigning it any object that implements that interface lets the same line of calling code — reference.method() — invoke a completely different method body depending on which concrete class was actually assigned, without the calling code needing to know or care which implementation it's dealing with. This is the essence of polymorphism: one interface, many possible forms of behavior, resolved dynamically rather than fixed in advance. It's a more direct illustration of the concept than something like method overloading, which is resolved at compile time based on argument types and doesn't involve this runtime dispatch at all — a distinction worth holding onto, since overloading and polymorphism get conflated but work through entirely different mechanisms. Recognizing runtime method resolution through a supertype or interface reference, as opposed to compile-time resolution, is the specific skill these polymorphism questions test.

⚠ Common exam trap

Oracle often tests the distinction between compile-time polymorphism (overloading) and runtime polymorphism (overriding with interface/superclass references), so candidates mistakenly choose overloading or overriding alone without the reference context.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Using an interface reference to call a method on an implementing object

Polymorphism in Java allows an object to take multiple forms, typically achieved through inheritance and interfaces. Option B demonstrates this by using an interface reference to invoke a method on an implementing object, where the actual method executed is determined at runtime based on the object's class, not the reference type.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Overloading a method with different parameter lists

    Why it's wrong here

    Overloading is compile-time polymorphism, but runtime polymorphism is typically emphasized.

  • Using an interface reference to call a method on an implementing object

    Why this is correct

    Polymorphism allows one interface to be used for different implementations, as when an interface reference invokes the appropriate method at runtime.

  • Using static methods

    Why it's wrong here

    Static methods are not polymorphic; they are resolved at compile time.

  • Overriding a method in a subclass

    Why it's wrong here

    Overriding is part of polymorphism, but using an interface reference is a clearer demonstration of polymorphic behavior.

  • Using final methods

    Why it's wrong here

    Final methods prevent overriding, which is not polymorphism.

About these practice questions

Courseiva writes every 1Z0-811 question from scratch — 481 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on 1Z0-811

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. class Parent { void show() { System.out.print("Parent"); } } class Child extends Parent { void show() { System.out.print("Child"); } } public class Test { public static void main(String[] args) { Parent p = new Child(); p.show(); } } What is the output?

medium
  • A.Compilation error
  • B.No output
  • C.Parent
  • D.Child
  • E.Runtime error

Why D: Although the reference is Parent, the object is Child, and show() is overridden, so Child's version is called.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.