Выражение синтаксически не верное..
строка 40, позиция 1273
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 granDadName = reader.readLine();
Cat catGrandDad = new Cat(granDadName);
String grandMotherName = reader.readLine();
Cat catGrandMother = new Cat(grandMotherName);
String dadName = reader.readLine();
Cat catDad = new Cat(dadName, granDadName);
String motherName = reader.readLine();
Cat catMother = new Cat(motherName, grandMotherName);
String sonName = reader.readLine();
Cat catSon = new Cat(sonName, dadName, granDadName);
String daughterName = reader.readLine();
Cat catDaughter = new Cat(daughterName, motherName, grandMotherName);
System.out.println(catGrandDad);
System.out.println(catGrandMother);
System.out.println(catDad);
System.out.println(catMother);
System.out.println(catSon);
System.out.println(catDaughter);
public static class Cat {
private String name;
Cat parent;
Cat grandParent;
Cat(String name) {
this.name = name;
}
Cat(String name, Cat parent) {
this.name = name;
this.parent = parent;
}
Cat(String name, Cat parent, Cat grandParent){
this.name = name;
this.parent = parent;
this.grandParent = grandParent;
}
@Override
public String toString() {
if (grandParentparent == null && parent == null)
return "The cat's name is " + grandParent.name + ", no mother, no father";
if (grandParent == null)
return "The cat's name is " + parent.name + ", no mother, father is " + grandParent.name;
return"The cat's name is " + parent.name + ", no mother, father is " + grandParent.name;
else
return "The cat's name is " + name + ", mother is " + parent.name + ", father is"+ parent.name;
}
}
}