Question: In java I have Weight1 objects a,b,c,d,e,f,g,h and Weight2 objects w,x,y,z note weight2 is a subclass of weight1 e,f,g, and h are instantiated as weight2.
In java I have Weight1 objects a,b,c,d,e,f,g,h and Weight2 objects w,x,y,z note weight2 is a subclass of weight1 e,f,g, and h are instantiated as weight2. However, they are not displaying as weight2 objects but weight1. Is there anyway to make for example f display as the weight2 object without casting it?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
