200+ câu trắc nghiệm Lập trình Java cơ sở có đáp án - Phần 6

Cho class như sau: 1: public interface Comparable { 2: int compareTo(Object other); 3: } 4: class Employee implements Comparable { 5: public int compareTo(Object other) { 6: Employee other =

30/30

Cho class như sau: 1: public interface Comparable { 2: int compareTo(Object other); 3: } 4: class Employee implements Comparable { 5: public int compareTo(Object other) { 6: Employee other = (Employee) otherObject; 7: return 0; 8: } 9: } Chương trình trên sai ở dòng nào"

1

2, 4

5

Không sai ở dòng nào cả

Giải thích

Chọn đáp án A