Assume that the following classes have been defined:

public class Poe extends Kylo {

public void method2() {

super.method2();

print("Poe 2 ");

}



public String toString() {

return "Poe " + super.toString();

}

}



public class Kylo extends Finn {

public void method1() {

print("Kylo 1 ");

}



public String toString() {

return "Kylo";

}

}



public class Finn extends Rey {

public void method2() {

print("Finn 2 ");

method1();

}

}



public class Rey {

public String toString() {

return "Rey";

}



public void method1() {

print("Rey 1 ");

}



public void method2() {

print("Rey 2 ");

}

}

Given the classes above, what output is produced by the following code? (Since the code loops over the elements of an array of objects, write the output produced as the loop passes over each element of the array separately.)

Rey[] elements = { new Finn(), new Rey(), new Poe(), new Kylo() };

for (int i = 0; i < elements.length; i++) {

println(elements[i]);

elements[i].method1();

println();

elements[i].method2();

println();

println();

}

1 answer

Kylo-1
Similar Questions
  1. Here is the source code for the Kitty class:public class Kitty { String name; int age; public Kitty(){ } public void
    1. answers icon 2 answers
  2. Which term refers to the issues on which the public's attention is focused?(1 point) public influence public opinion public
    1. answers icon 1 answer
  3. using System;namespace RecipeApp { class Recipe { public string[] Ingredients { get; set; } public string[] OriginalIngredients
    1. answers icon 1 answer
  4. using System;namespace RecipeApp { class Recipe { public string[] Ingredients { get; set; } public string[] OriginalIngredients
    1. answers icon 1 answer
more similar questions