Не вижу где ошибся. Что не так? Подскажите, пожалуйста.
package com.javarush.task.task19.task1904;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
/*
И еще один адаптер
*/
public class Solution {
public static void main(String[] args) throws IOException, ParseException {
}
public static class PersonScannerAdapter implements PersonScanner{
private Scanner fileScanner;
public PersonScannerAdapter(Scanner fileScanner){
this.fileScanner = fileScanner;
}
@Override
public Person read() throws IOException, ParseException {
Scanner scannerReload = new Scanner(System.in);
Person person = null;
if(scannerReload.hasNextLine()) {
String[] line = scannerReload.nextLine().
split("\\s", 4);
SimpleDateFormat sdf = new SimpleDateFormat("dd MM yyyy");
Date date = sdf.parse(line[3]);
person = new Person(line[1], line[2], line[0], date);
}
return person;
}
@Override
public void close() throws IOException {
this.fileScanner.close();
}
}
}