Start learning 50% faster. Sign in now
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.
Which of the following numbers will replace the question mark (?) in the given series?
29, 33, ?, 113, 369
Select the option that is related to the third word in the same way as the second word is related to the first word.
(The words must be considere...
In the following questions below are given some statements followed by some conclusions based on those statements. Taking the given statements to be tr...
The question that follows is based on he given 3-digit numbers.
275, 463, 567, 428, 394, 663, 129
If 6 is added to this first digit of eve...
If a mirror is placed on the shaded line, which of the following options is the correct reflection of the given shape?
Statement:
I. Cases of obesity, diabetes and other similar diseases are increasing.
II. Fast food also has very few antioxidants and les...
Which letter-cluster will replace the question mark (?) to complete the given series?
MKPN, LMOP, ?, JQMT, ISLV
Who sits at the extreme right end of the row?
How many triangles are there in the given figure?
Statement. The construction of the Metro project will be around 50 crore rupees.
Select one of the following options.