In this java programming video tutorial we will study and understand the concept of Upcasting and Downcasting. We will also understand the difference between upcasting and downcasting in Java.
Upcasting in Java –
Upcasting is casting a subtype to a supertype, upward to the inheritance tree. Upcasting happens automatically and we don’t have to explicitly do anything.
Downcasting in Java –
When Subclass type refers to the object of Parent class, it is known as downcasting. If we perform it…