Multiple Choices
Answer (Choose 1 answer)
Given the following code
class Base {}
class Agg extends Base{public String getFields(){String name = "Agg";return name;}
}
public class Avf{
public static void main(String argv[]){Base a = new Agg();//Here}
}
What code placed after the comment //Here will result in calling the getFields method resulting in the output of the string "Agg"?
A. System.out.println(a.getFields());
B. System.out.println(a.name);
C. System.out.println((Base) a.getFields());
D. System.out.println( ((Agg) a).getFields());