Помогите, что не так ?
package com.javarush.task.task08.task0824;
/*
Собираем семейство
*/
import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
public class Solution {
public static void main(String[] args) {
//напишите тут ваш код
Human child1 = new Human("Michael",true,16);
Human child2 = new Human("Tony",true,17);
Human child3 = new Human("Richard",true,18);
ArrayList<Human> children = new ArrayList<>();
children.add(child1);
children.add(child2);
children.add(child3);
Human Father = new Human("Andrew",true,40,children);
Human Mother = new Human("Lina",false,40,children);
ArrayList<Human> parents = new ArrayList<>();
parents.add(Father);
parents.add(Mother);
Human gFather1 = new Human("Василий",true,66);
Human gMother1 = new Human("Мария",false,66);
Human gFather2 = new Human("Анатолий",true,62);
Human gMother2 = new Human("Екатерина",false,62);
System.out.println(Father.toString());
}
public static class Human {
//напишите тут ваш код
String name;
boolean sex;
int age;
ArrayList<Human> children = new ArrayList<>();
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, ArrayList<Human> children) {
this.name = name;
this.sex = sex;
this.age = age;
this.children = children;
}
public String toString(String name, boolean sex, int age, ArrayList<Human> children) {
String text = "";
text += "Имя: " + this.name;
text += ", пол: " + (this.sex ? "мужской" : "женский");
text += ", возраст: " + this.age;
int childCount = this.children.size();
if (childCount > 0) {
text += ", дети: " + this.children.get(0).name;
for (int i = 1; i < childCount; i++) {
Human child = this.children.get(i);
text += ", " + child.name;
}
}
return name;
}
}
}