Runtime polymorphism (or dynamic method dispatch) occurs when a method's implementation is determined at runtime. This is achieved using method overriding in OOP. A derived class overrides a method of the base class, and the method to execute is determined by the type of the object being referenced at runtime. Example: class Animal { void sound() { System.out.println("Animal makes a sound"); }} class Dog extends Animal { void sound() { System.out.println("Dog barks"); }} public class Main { public static void main(String[] args) { Animal animal = new Dog(); // Base class reference pointing to a derived class object animal.sound(); // Outputs: Dog barks }} Why Other Options Are Incorrect: 1. Method with the same name but different parameters within the same class: This is compile-time polymorphism (method overloading), not runtime polymorphism. 2. Default arguments in methods: Default arguments provide flexibility but are unrelated to polymorphism. They simplify method calls without changing the behavior based on the object’s runtime type. 3. Static methods for shared functionality: Static methods are class-level and cannot participate in runtime polymorphism, as they are resolved at compile time. 4. Constructor with a parameter list in the derived class: Constructors are not polymorphic as they do not inherit or override behavior in OOP.
(X + 140) liters of mixture A contains milk and water only such that quantity of water in it is (X – 100) liters less than quantity of milk in it. 75%...
A vessel holds (p + 200) liters of milk and p liters of honey. When 110 liters of honey and 50 liters of milk are added to the ve...
In a mixture of milk & water, 80 litres water is mixed due to which ratio changes from 3 : 4 to 1 : 3. Find initial quantity of mixture. (in litres)
From a container of Beer, a thief has stolen 25 litres of beer and replaced it with same quantity of water. He again repeated the same process. Thus in...
Two types of Pulses costs Rs. 240/kg and Rs. 340/kg. In what ratio should these be mixed so that obtained mixture sold at Rs. 324/kg to earn a profit of...
450 ml of a mixture contains milk and water in the ratio of 15 respectively. If 70 ml of water and 80 ml of milk are added into it, then the ratio of mi...
Quantity of water in a 250 litres mixture (alcohol + water) is 30 litres less than the quantity of alcohol in it. Find the quantity of water to be mixed...
140 litres of mixture X contains acetone and glycerine in the ratio 5:9, respectively. 70 litres of the mixture is withdrawn and labelled as mixture Y a...
Jar A contains ‘X’ ml mixture of milk and water in the ratio of 4 :3. Jar B contains ‘X’ ml mixture of milk and water in the rat...
A container can hold 1,000 liters of liquid. If it is filled with 30% water and 70% oil, how many liters of oil are in the container? If 50 liters of oi...