Multiple Choice Question

Quiz Guidelines



Consider the following code:

interface Flyer{ String getName(); }
class Bird implements Flyer{
public String name;
public Bird(String name){ = name;
}public String getName(){ return name; }
class Eagle extends Bird {
public Eagle(String name){
}public class TestClass {
public static void main(String[] args) throws Exception {
Flyer f = new Eagle("American Bald Eagle");          //PRINT NAME HERE
}  }

Which of the following lines of code will print the name of the Eagle object?

Select 3 options

A. System.out.println(;
B. System.out.println(f.getName());
C. System.out.println(((Eagle)f).name);
D. System.out.println(((Bird)f).getName());
E. System.out.println(;
F. System.out.println(Eagle.getName(f));

Q&A Set: