Method overloading is

  1. Static polymorphism

  2. Dynamic polymorphism

  3. Both static and dynamic polymorphism

  4. Not a polymorphism.


Correct Option: A
Explanation:

To answer this question, the user needs to have a basic understanding of polymorphism.

Method overloading is a feature in object-oriented programming where a class can have multiple methods with the same name but with different parameters. This allows the same method name to be used for different actions, making the code more readable and easier to use.

Now, let's go through each option and explain why it is right or wrong:

A. Static polymorphism: This option is correct. Method overloading is an example of static polymorphism because the method to be called is determined at compile-time based on the number, types, and order of parameters passed to the method.

B. Dynamic polymorphism: This option is incorrect. Dynamic polymorphism is when the method to be called is determined at runtime based on the object type. This is different from method overloading, which is an example of static polymorphism.

C. Both static and dynamic polymorphism: This option is incorrect. Method overloading is an example of static polymorphism only.

D. Not a polymorphism: This option is incorrect. Method overloading is a type of polymorphism, specifically static polymorphism.

Therefore, the correct answer is: A. Static polymorphism.

Find more quizzes: