Back to the 2026 paper

Module 3: Methods of Java

20262m

Runtime polymorphism in Java is primarily achieved through:

(i) Method overriding
(ii) Constructor overloading
(iii) Method overloading
(iv) Static variables

Worked SolutionAI Assisted

Answer: (i) Method overriding

Runtime polymorphism occurs when a superclass reference refers to a subclass object and an overridden instance method is selected according to the object's actual type at runtime.

class Animal { void sound() { System.out.println("sound"); } }
class Dog extends Animal { @Override void sound() { System.out.println("bark"); } }
Animal a = new Dog();
a.sound(); // bark

Similar questions

Budget AppAndroid App

Pocketly on Android

Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.