Problem 174
Sorting Strings
Repeat the previous assignment. This time, instead of sorting by the year (which is an int), sort by the make (which is a String). You’ll need to use compareTo() to do this.
From which file do you want to load this information? cars.txt Data loaded. Data sorted. Car 1 Make: Chevrolet Model: Chevette Year: 1980 License: J43-SMB Car 2 Make: Dodge Model: Neon Year: 1996 License: G74-LLC Car 3 Make: Ford Model: Mustang Year: 1966 License: AZUCAR Car 4 Make: Honda Model: Civic Year: 1993 License: 883-RS9 Car 5 Make: Toyota Model: Camry Year: 1985 License: 622-VRX
◄ 173: Sorting an Array of Objects 175: Sorting Records on Two Fields ►
Adapted from ProgrammingByDoing.com
©2013 Graham Mitchell
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.