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/I_am_transparent Oct 09 '25
If i have ten TV's in a restaurant and there are 4 Sony, 4 LG and 2 Samsung, there will be three different API's to turn them on and off. At the end of the day, I want to turn them off. Instead of looping three lists of each model, if they inherit the TV class, I can have a list of TV's and a single loop to turn them on and off.