Тип данных присутствует, почему ругается компилятор?
package com.javarush.task.task07.task0724;
/*
Семейная перепись
*/
public class Solution {
public static void main(String[] args) {
Human grandfather = new Human("Толя", true, 65);
Human grandfather1 = new Human("игорь", true, 60);
Human grandmother = new Human("Оля", false, 59);
Human grandmother1 = new Human("Юля", false, 64);
Human pa = new Human("Свирид", true, 45, grandfather, grandmother);
Human pa1 = new Human("Свирид", true, 45, grandfather1, grandmother1);
Human pa2 = new Human("Свирид", true, 45, grandfather, grandmother1);
Human ma = new Human("Свирид", true, 45, grandfather1, grandmother);
Human ma1 = new Human("Свирид", true, 45, grandfather,grandmother);
System.out.println(grandfather);
System.out.println(grandfather1);
System.out.println(grandmother);
System.out.println(grandmother1);
System.out.println(pa);
System.out.println(pa1);
System.out.println(pa2);
System.out.println(ma);
System.out.println(ma1);
// напишите тут ваш код
}
public static class Human {
String name;
Boolean sex;
int age;
Human father;
Human mother;
public Human(String name, boolean sex, int age){
this.name = name;
this.sex = sex;
this.age = age;
}
public Human(String name, boolean sex, int age, Human father, Human mother){
this.name = name;
this.sex = sex;
this.age = age;
this.father = father;
this.mother = mother;
}
public String toString() {
String text = "";
text += "Имя: " + this.name;
text += ", пол: " + (this.sex ? "мужской" : "женский");
text += ", возраст: " + this.age;
if (this.father != null) {
text += ", отец: " + this.father.name;
}
if (this.mother != null) {
text += ", мать: " + this.mother.name;
}
return text;
}
}
}