Upcasting is treating a subclass object as a superclass object.
Upcasting in Java involves converting a subclass reference to a superclass reference. This is safe because the subclass is a specialized version of the superclass. For example, if you have a class `Product` and a subclass `Book`, you can upcast `Book` to `Product`. This allows for polymorphic behavior, where the method of the actual object type is called at runtime.
Additional Notes
What is upcasting in Java?
Track: Java
Topic: Core Java
Focus: Upcasting and Dynamic Dispatch
Topics:Core JavaJavaUpcasting and Dynamic Dispatch