Answer the question
In order to leave comments, you need to log in
(Java) How to sort this array of objects?
How to sort the given List array by the id string, so that the object with id=true comes first, and after false. Or is it unrealistic?
public class Met {
public static void main(String[] args){
Object[] List = {
new Student(),
new Schoolboy()
};
}
public static class Student{
private boolean id=true;
public boolean isId() {
return id;
}
}
public static class Schoolboy{
private boolean id=false;
public boolean isId() {
return id;
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question