Question: What is displayed on the screen after running the code below. public class A 2 { public static void main ( String [ ] args

What is displayed on the screen after running the code below.
public class A2{
public static void main(String[] args){
Fruit[] fruits = new Fruit[5];
fruits[0]= new Fruit();
fruits[1]= new Apple();
fruits[2]= new Orange();
fruits[3]= new GoldenDelicious();
fruits[4]= new McIntosh();
for(Fruit f1: fruits){
f1.saySomething();
}
Fruit[] apples = new Apple[3];
apples[0]= new Apple();
apples[1]= new GoldenDelicious();
apples[2]= new McIntosh();
for(Fruit f2: apples){
//add code here
}
}
}

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!