19
Answer (Choose 1 answer)
A. Comparator
B. Comparable<Student>
C. Comparator<Student>
D. Comparable
Read the following program
import java.util.*;
class Student {
private String name;private int age;
public int getAge() { return age;}
public Student(String name, int age) { this.name = name;this.age = age;}
public String toString()
return "Name = " + name + ", Age = " + age;}}
class SortByAge implements [Blank A] {
@Override
public int compare(Student 01, Student o2) { return o1.getAge() - o2.getAge();}
}
public class Main {
public static void main(String[] args) { Student Is = new Student(21