259 câu trắc nghiệm tổng hợp Java cơ bản có đáp án

Đ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{ protected int getAge(int added) { return super.getAge()+added; }

97/259

Đ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{ protected int getAge(int added) { return super.getAge()+added; } } Chọn một Câu trả lời 

Không có lỗi biên dịch.

Có lỗi biên dịch: getAge() has in Man can not have weaker same access modifier than in Student.

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.

Giải thích

Chọn đáp án A