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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!