Nguyên Kim
New member
class Student {
public int getAge() {
return 10;
}
}
public class Man extends Student {
protected int getAge(int added) {
return super.getAge() + added;
}
}</blockquote>
Đoạn mã sau có lỗi biên dịch nào?
A. Không có lỗi biên dịch.
B. Có lỗi biên dịch: getAge() has in Man can not have weaker same access modifier than in Student.
C. Có lỗi biên dịch:call to super, must be the first in constructor in class Man.
D. Có lỗi biên dịch: getAge() in Student and Man can not have the same access arguments.
public int getAge() {
return 10;
}
}
public class Man extends Student {
protected int getAge(int added) {
return super.getAge() + added;
}
}</blockquote>
Đoạn mã sau có lỗi biên dịch nào?
A. Không có lỗi biên dịch.
B. Có lỗi biên dịch: getAge() has in Man can not have weaker same access modifier than in Student.
C. Có lỗi biên dịch:call to super, must be the first in constructor in class Man.
D. Có lỗi biên dịch: getAge() in Student and Man can not have the same access arguments.