Java MCQ: Which of the following best describes polymorphism in Java?
Answer:
Explanation:
Polymorphism in Java is a core concept of object-oriented programming that allows objects to be treated as instances of their parent class. This means that a single function or method can operate on different types of objects, allowing for dynamic method invocation.
There are two types of polymorphism in Java: compile-time (method overloading) and runtime (method overriding). Method overloading allows multiple methods with the same name but different parameter lists within the same class. Method overriding, on the other hand, allows a subclass to provide a specific implementation of a method already defined in its superclass.
Polymorphism promotes flexibility and reusability in code by allowing a general interface to interact with a wide variety of objects in a consistent manner.
Reference links:
https://www.rameshfadatare.com/learn-java-programming/
https://www.javaguides.net/p/java-tutorial-learn-java-programming.html