How to do it?
package zh.codegym.task.task19.task1921;
import java.util.ArrayList;
import java.util.*;
import java.io.*;
import java.text.*;
/*
约翰 约翰逊
*/
public class Solution {
public static final List<Person> PEOPLE = new ArrayList<>();
public static void main(String[] args) throws IOException{
String fileName = args[0];
BufferedReader re = new BufferedReader(new FileReader(fileName));
String line,name;
int len,year,day,month;
String birthString;
Person person;
String[] str;
SimpleDateFormat sdf = new SimpleDateFormat("MM dd yyyy");
Date birthDate;
while((line = re.readLine()) != null){
str = line.split(" ");
len = str.length;
birthString = str[len-3] + " " + str[len-2] + " " + str[len-1];
name = str[len-4];
try{
birthDate = sdf.parse(birthString);
person = new Person(name, birthDate);
PEOPLE.add(person);
}catch(ParseException e){
e.printStackTrace();
}
}
re.close();
}
}