PRO192_-_C1_-_FE_-_SU_2023_391.webp
H

PRO192_-_C1_-_FE_-_SU_2023_391.webp

(Choose 1 answer)
}
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 Comparator<Student> { @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[3];
Is[0] = new Student("A", 25);Is[1] = new Student("B", 20);
Is[2] = new Student("C", 22);
Arrays.sort(ls, 0, 2, new SortByAge());
for(Student s: Is)System.out.println(s);
}
Ext (20)

Thông tin

Category
PRO192
Thêm bởi
Hohenheim90
Ngày thêm
Lượt xem
2,667
Lượt bình luận
14
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PRO192_-_C1_-_FE_-_SU_2023_391.webp
File size
74.8 KB
Dimensions
1713px x 893px

Share this media

Back
Bên trên Bottom