How I can fix it?
package pl.codegym.task.task20.task2013;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.List;
/*
Externalizable dla klasy Person
*/
public class Solution {
public static class Person implements Externalizable {
private String firstName;
private String lastName;
private int age;
private Person mother;
private Person father;
private List<Person> children;
public Person() {
}
public Person(String firstName, String lastName, int age) {
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
}
public void setMother(Person mother) {
this.mother = mother;
}
public void setFather(Person father) {
this.father = father;
}
public void setChildren(List<Person> children) {
this.children = children;
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeChars(firstName);
out.writeChars(lastName);
out.writeInt(age);
out.writeObject(mother);
out.writeObject(father);
out.writeObject(children);
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
firstName = in.readLine();
lastName = in.readLine();
age = in.readInt();
mother = (Person) in.readObject();
father = (Person) in.readObject();
while (in.available() < 0) {
children.add((Person) in.readObject());
}
}
public static void main(String[] args) {
}
}
}
//public class Solution {
// public static class Person implements Externalizable {
// private String firstName;
// private String lastName;
// private int age;
// private Person mother;
// private Person father;
// private List<Person> children;
//
// public Person() {
//
// }
//
// public Person(String firstName, String lastName, int age) {
// this.firstName = firstName;
// this.lastName = lastName;
// this.age = age;
// }
//
// public void setMother(Person mother) {
// this.mother = mother;
// }
//
// public void setFather(Person father) {
// this.father = father;
// }
//
// public void setChildren(List<Person> children) {
// this.children = children;
// }
//
// @Override
// public void writeExternal(ObjectOutput out) throws IOException {
// out.writeChars(firstName);
// out.writeChars(lastName);
// out.writeInt(age);
// out.writeObject(mother);
// out.writeObject(father);
// out.writeObject(children);
// }
//
// @Override
// public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
// firstName = in.readLine();
// lastName = in.readLine();
// age = in.readInt();
// mother = (Person) in.readObject();
// father = (Person) in.readObject();
// }
// }
// }
//
// public static void main(String[] args) {
//
// }
//}
//
///*
//Externalizable dla klasy Person
//Klasa Person musi być serializowana za pomocą interfejsu Externalizable.
//Popraw błąd serializacji.
//Nie zmieniaj sygnatur metody.
//
//Requirements:
//1. Klasa Solution.Person powinna obsługiwać interfejs Externalizable.
//2. Metody readExternal i writeExternal muszą umożliwiać poprawne serializowanie i deserializowanie obiektów Person.
//3. Klasa Solution.Person musi posiadać konstruktor bez parametrów.
//4. Klasa Solution.Person musi posiadać konstruktor o trzech parametrach (String firstName, String lastName, int age).
// */