Don't understand. Validation don't pass.
package com.codegym.task.task19.task1921;
import java.io.BufferedReader;
import java.io.FileReader;
import java.text.SimpleDateFormat;
import java.util.*;
/*
John Johnson
*/
public class Solution {
public static final List<Person> PEOPLE = new ArrayList<>();
public static void main(String[] args) throws Exception {
String fileName;
String[] personData;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM dd yyyy");
Date birthDate;
fileName = args[0];
FileReader fileReader = new FileReader(fileName);
BufferedReader reader = new BufferedReader(fileReader);
while (reader.ready()) {
String name = "";
personData = reader.readLine().split(" ");
int length = personData.length;
String dateinString = personData[length-3] + " " + personData[length-2] + " " + personData[length-1];
birthDate = simpleDateFormat.parse(dateinString);
for (int i = 0; i < personData.length-3; i++) {
name = name + " " + personData[i];
}
name = name.replaceAll("-", " ");
PEOPLE.add(new Person(name, birthDate));
}
System.out.println(PEOPLE.get(1).getName());
fileReader.close();
}
}