+ 2
Explain run time polymorphism in Java ?
3 odpowiedzi
+ 1
same function work differntly on dfrnt object(bt having same super class)
+ 1
The best example of run time polymorphism that i could think of is method overriding.
0
Run-time polymorphism in Java happens when the program decides which method to call while it's running, not when the code is written. This happens through method overriding, where a subclass gives its own version of a method already defined in the parent class. The program chooses which version to run based on the object at that moment.
For more detailed information, I recommend reading the blog on :
"https://uncodemy.com/blog/virtual-function-in-java-run-time-polymorphism-in-java/"
Which provides clear and easy-to-understand explanations on this topic...