Почему не работает, кто подскажет? import java.util.ArrayList; public class Solution { public static void main(String[] args) { //напишите тут ваш код ArrayList<Human> chi = new ArrayList<>(); Human rebenok1 = new Human("Дима", true, 34); Human rebenok2 = new Human("Оля", false, 23); Human rebenok3 = new Human("Маша", false, 21); chi.add(rebenok1); chi.add(rebenok2); chi.add(rebenok3); ArrayList<Human> pap = new ArrayList<>(); Human papa = new Human("Владимир", true, 54, chi); pap.add(papa); ArrayList<Human> mam = new ArrayList<>(); Human mama = new Human("Алена", false, 51, chi); mam.add(mama); ArrayList<Human> grand = new ArrayList<>(); Human ded = new Human("Кузьмич", true, 75, pap); Human ded2 = new Human("Валерий", true, 73, mam); Human babushka = new Human("Митрофавовна", false, 70, pap); Human babushka2 = new Human("Никифоровна", false, 71, mam); grand.add(ded); grand.add(ded2); grand.add(babushka); grand.add(babushka2); ArrayList<Human> itog = new ArrayList<>(); itog.addAll(chi); itog.addAll(pap); itog.addAll(mam); itog.addAll(grand); for (Human xxx : itog){ System.out.println(xxx); } } public static class Human { //напишите тут ваш код String name; boolean sex; int age; ArrayList<Human> children; 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 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 text; } } }