Question: Consider the following code. Is this valid in Java? Vehicle x = new Sedan ( ) ; No , because the new instance does not
Consider the following code. Is this valid in Java?
Vehicle new Sedan;
No because the new instance does not match the data type
Yes, if Sedan is a subclass of Vehicle
Yes, because all sedans are vehicles
Yes, if Sedan is the parent class to Vehicle
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
