r/javahelp • u/Nobody37373 • Oct 08 '25
Unsolved Why learn Upcasting/Downcasting?
After days of getting stuck in this concept, i finally feel like giving up and never looking at it back again. After countless hours of Googling, asking assistance from AI, watching YouTube videos, I am now falling into a guilt of why I am even wasting time over a single concept. I feel I should move on at this point. Before this one topic, one google search used to clear all my doubts so effortlessly guys.
But this one seems like a tough nut to crack. Can anyone help me out on this?
I know the 'how' and 'what', but I am not reaching anywhere near to the 'why' of this one concept.
View all comments
Show parent comment
1
u/Nobody37373 Oct 09 '25
Have you, by any chance interchanged the types. I think it should be the reverse order of what you wrote here. Sorry if I am wrong. Actually, I understand it like this :
MySQL database = new MySQL();
"Create a reference variable named 'Database' of type MySQL, and store the object of MySQL in it"
Is it wrong?