Reading records from a text file.Three class program creating an array of people objects – uses LocalDate class.
Fields are as follows – First Name, Last Name, Date of Birth.
NOTE: The date in the text file is in default date format for LocalDate i.e. “yyyy-MM-dd” (MM is months, mm is used for minutes)
Alex,Alpha,2012-06-17
Bruce,Bravo,2013-01-01
Chunky,Charlie,2011-12-01
Dave,Delta,2012-10-30
Eric,Echo,2011-09-30
Here however the date of birth is not read in as a String but as a LocalDate object.
LocalDate allows us to do date arithmetic that we cannot do with String.
The links below allow you to download the java files
NOTE: If the date in the text file is NOT in the default format you have to use “DateTimeFormatter” to correct this. In the manager class above you will find the alternative “DateTimeFormatter” code commented out in order to demonstrate how to use it.