second condition is missing
package com.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 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 children;
private Person() {
this("unk", "unk,", 0);
}
public Person(String firstName, String lastName, int age) {
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.mother = null;
this.father = null;
this.children = null;
}
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.writeObject(firstName);
out.writeObject(lastName);
out.writeInt(age);
out.writeObject(mother);
out.writeObject(father);
out.writeObject(children);
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
firstName = (String) in.readObject();
lastName = (String) in.readObject();
age = in.readInt();
mother = (Person)in.readObject();
father = (Person)in.readObject();
children = (List<Person>) in.readObject();
}
}
public static void main(String[] args) {
}
}