Đoạn mã sau có lỗi biên dịch nào?
class Student {
public int getAge(){
return 10;
}
}
public class Man extends Student{
public int getAge(int added) {
return super.getAge()+added;
}
}
Không có lỗi biên dịch.
Có lỗi biên dịch: getAge() in Student and Man can not have the same access modifier.
Có lỗi biên dịch:call to super, must be the first in constructor in class Man.
Có lỗi biên dịch: getAge() in Student and Man can not have the same access arguments.
Quảng cáo
Trả lời:
Chọn đáp án A
Vì:
getAge() ở Student và Man có arguments khác nhau, nên chúng là các phương thức khác nhau.
Hot: Giáo án năng lực số, PPT AI khởi động lớp 1-12 (Update 2026) (chỉ từ 150k). Tải ngay