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)


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

The text file

The UIClass

The ManagerClass

The PeopleClass

The full solution

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.