Which of the following class inheritance scenarios describes polymorphism in Java?
1 one class inherits from multiple parent classes
2 one class implementing many interfaces
3 multiple classes implementing one interface
4 multiple classes inherit from single abstract parent class
I saw different answers in different places. Is anybody 100% about the answers?
Well, 1's not even possible in Java, so you can rule that out.
Edit: unless they mean an inheritance chain, I suppose.
I'd agree, 3 and 4 are the best fit. Polymorphism is about treating objects as if they are of a common class, and they behave appropriately according to which subclass they are an instance of. You could make a case that polymorphism can happen whenever you have inheritance, but 3 and 4 are a better example for demonstrating it.