Подскажите, что тут не так?
package com.javarush.task.task06.task0621;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Родственные связи кошек
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String grandfatherName = reader.readLine();
Cat catGrandfather = new Cat(grandfatherName,null,null);
String grandmotherName = reader.readLine();
Cat catGrandmother = new Cat(grandmotherName,null,null);
String fatherName = reader.readLine();
Cat catDad = new Cat(fatherName, catGrandfather,null);
String motherName = reader.readLine();
Cat catMom = new Cat(motherName,null,catGrandmother);
String sunName = reader.readLine();
Cat catSun = new Cat(sunName,catDad,catMom);
String daughterName = reader.readLine();
Cat catDaughter = new Cat(daughterName,catDad,catMom);
System.out.println(catGrandfather);
System.out.println(catGrandmother);
System.out.println(catDad);
System.out.println(catMom);
System.out.println(catSun);
System.out.println(catDaughter);
}
public static class Cat {
private String name;
private Cat father;
private Cat mother;
Cat(String name) {
this.name = name;
}
Cat(String name, Cat father, Cat mother) {
this.name = name;
this.father = father;
this.mother = mother;
}
@Override
public String toString() {
String f= (father!=null)? ", father is " + father.name:", no father";
String m= (mother!=null)? ", mother is " + mother.name:", no mother";
return "The cat's name is " + name +f+m;
}
}
}