public Person read() throws IOException { Person person = null; if (fileScanner.hasNext()) { String s = fileScanner.nextLine(); String[] parts = s.split(" "); String firstName = parts[1]; String middleName = parts[2]; String lastName = parts[0]; Calendar calendar = new GregorianCalendar(Integer.parseInt(parts[5]), Integer.parseInt(parts[4])-1, Integer.parseInt(parts[3])); person = new Person(firstName, middleName, lastName, calendar.getTime()); } return person; } This is the work with the month, Calendar calendar = new GregorianCalendar , for which the -1 just do not understand
-1used to decrease the number by one. What kind of logic the author laid in this code, I don’t know, but it would be logical to assume that the value ofparts[4]goes beyond certain limits! - JVic