PRO192_-_SP_2023_-_BL5_-_FE_118.webp
hoangduc2001

PRO192_-_SP_2023_-_BL5_-_FE_118.webp

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());

Thông tin

Category
PRO192
Thêm bởi
hoangduc2001
Ngày thêm
Lượt xem
2,547
Lượt bình luận
16
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom