Forums Register Login

polymorphism........................

+Pie Number of slices to send: Send
hai,

i've a question regarding polymorphism.
is polymorphism possible only when the superclass is abstract?

give me some tips.....
+Pie Number of slices to send: Send
No, there is no requirement that the superclass is abstract. Why do you think that?
+Pie Number of slices to send: Send
The bit about extends Object is redundant, but it is a reminder that classes implicitly extend Object. If Object were abstract, you couldn't write new Object()
That code should give output similar to this:-
java.lang.Object@abce1234
Campbell
Ritchie

That shows the unoverridden and two overridden forms of toString, i.e. polymorphism where the superclass is not abstract.
Live a little! The night is young! And we have umbrellas in our drinks! This umbrella has a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 415 times.
Similar Threads
polymorphism
polymorphism
Method Overloading and overriding
4 key points about Oops
Java Questions
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 19:18:50.