Skip to content

Instantly share code, notes, and snippets.

@EbbeVang
Created March 6, 2019 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EbbeVang/5c123b67421c3d48f2a9dd97fc05fbbb to your computer and use it in GitHub Desktop.
Save EbbeVang/5c123b67421c3d48f2a9dd97fc05fbbb to your computer and use it in GitHub Desktop.
Exercise for EC2: implement the citizen class
//the main method
ArrayList<Citizen> citizens = new ArrayList<>();
citizens.add(new Citizen("Liv", "Vang", 2911071234L));
citizens.add(new Citizen("Liv", "Andersen", 1505011234L));
citizens.add(new Citizen("Ebbe", "Vang", 2312721234L));
citizens.add(new Citizen("Ebbe", "Vang", 2412721234L));
Collections.sort(citizens);
System.out.println(citizens);
/*
expected output:
[Ebbe, Vang, 23/12 - 7212, Ebbe, Vang, 24/12 - 7212, Liv, Andersen, 15/05 - 0112, Liv, Vang, 29/11 - 0712]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment