Question: Java polymorphism Fruit Apple Orange + makeAppleCider) void + makeOrange Juice) void GoldenDelicious Mclntosh And assume that the following code is given: Fruit fruit =
Java polymorphism
Fruit Apple Orange + makeAppleCider) void + makeOrange Juice) void GoldenDelicious Mclntosh And assume that the following code is given: Fruit fruit = new G ldenDe icious(); Orange orange = new Orange(); Answer the following questions, and explain your answer. a. Isfruit instanceof Fruit? b. Is fruit instanceof Orange? c. Is fruit instanceof Apple? d. Is fruit instanceof GoldenDelicious? e. Is fruit instanceof McIntosh? f. Is orange instanceof Orange? g. Is orange instanceof Fruit? h. Is orange instanceof Apple? i. Can fruit invoke makeAppleCider method? . Can orange invoke makeAppleCider method? k. Can fruit invoke makeOrangeJuice method? I. Can orange invoke makeOrangeJuice method? m. Is the statement Orange pnew Apple () legal? n. Is the statement McIntosh p new Apple() legal? o. Is the statement Apple pnew McIntosh () legal
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
