I tried so many of them. A little help is appreciated.. Thanks..
package com.codegym.task.task19.task1921;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
/*
John Johnson
*/
public class Solution {
public static final List<Person> PEOPLE = new ArrayList<>();
public static void main(String[] args) throws FileNotFoundException {
try(BufferedReader fileReader = new BufferedReader(new FileReader(args[0]))) {
SimpleDateFormat sdf = new SimpleDateFormat("MM dd yyyy", Locale.ENGLISH);
while(fileReader.ready()) {
String line = fileReader.readLine();
String name = line.split("\\d+")[0];
Date birthday = sdf.parse(line.replaceAll("^[-\\d+ ]", "").trim());
PEOPLE.add(new Person(name, birthday));
}
} catch (IOException | ParseException e) {
e.printStackTrace();
}
}
}