PRO192_-_SP_2024_-_Block_5_-_FE_1921.webp
K

PRO192_-_SP_2024_-_Block_5_-_FE_1921.webp

Multiple Choices
(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
Kurourushi89
Ngày thêm
Lượt xem
4,497
Lượt bình luận
21
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom