I have a little problem with an assignment I'm working on. Basically, I have a file, with Student ID's and their first name in the following format:
17987 Beth
17950 Clark
17936 Aaron
I put the contents of the file in an array, and I need it sorted by the name, not the ID. If I use Arrays.sort(myArray)
it will sort it automatically by ID. I'm having a hard time understanding the Comparator, so if you could explain it step by step, it would be easier for me.
Thank you!