Java MCQ: What is polymorphism in Java?
a) The ability of a method to do different things based on the object it is acting upon
b) The ability of a class to have multiple constructors
c) The process of converting one type to another
d) The ability of a class to inherit from multiple classes
Answer:
a) The ability of a method to do different things based on the object it is acting upon
Explanation:
Polymorphism in Java is the ability of a method to perform different actions based on the object it is acting upon. This is a key concept in object-oriented programming, allowing for dynamic method invocation and promoting flexibility in code design.
Understanding polymorphism is essential for creating scalable and maintainable Java applications that can handle various types of objects seamlessly.
Reference links:
https://www.rameshfadatare.com/learn-java-programming/
https://www.javaguides.net/p/java-tutorial-learn-java-programming.html