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

126/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{

 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.

Giải thích

Chọn đáp án A