Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args){
- Person p1 = new Person("George");
- Person p2 = new Person("Ion");
- Person p3 = new Person("Zatreanu");
- Person.PersonComparator comp = new Person.PersonComparator();
- ArrayList<Person> lista = new ArrayList<Person>();
- lista.add(p1);
- lista.add(p3);
- lista.add(p2);
- Collections.sort(lista, comp);
- for(int i = 0; i < 3; i++){
- System.out.println(lista.get(i).getName());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement