package com.codegym.task.task08.task0824;

import java.lang.reflect.Array;
import java.util.ArrayList;

public class Solution {
    public static void main(String[] args) {

        ArrayList<Human> c1 = new ArrayList<Human>();
        ArrayList<Human> c2 = new ArrayList<Human>();
        ArrayList<Human> c3 = new ArrayList<Human>();

        //write your code here
        Human grandpa1 = new Human("Grandpa1",true,45,c2);
        Human grandpa2 = new Human("Grandpa2",true,85,c2);
        Human grandma1 = new Human("Grandma1",false,85,c2);
        Human grandma2 = new Human("Grandma2",false,35,c2);
        Human father = new Human("Father",true,25,c1);
        c2.add(father);
        Human mother = new Human("Mother",false,25,c1);
        c2.add(mother);
        Human chidl1 = new Human("Child1",false,5,c3);
        c1.add(chidl1);
        Human chidl2 = new Human("Child2",false,5,c3);
        c1.add(chidl2);
        Human chidl3 = new Human("Child3",false,5,c3);
        c1.add(chidl3);

        System.out.println(grandpa1.toString());
        System.out.println(grandpa2.toString());
        System.out.println(grandma1.toString());
        System.out.println(grandma2.toString());
        System.out.println(father.toString());
        System.out.println(mother.toString());
        System.out.println(chidl1.toString());
        System.out.println(chidl2.toString());
        System.out.println(chidl3.toString());
    }

    public static class Human {
        //write your code here
        String name = null;
        boolean sex;
        int age;
        ArrayList<Human> children;

        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 += "Name: " + this.name;
            text += ", sex: " + (this.sex ? "male" : "female");
            text += ", age: " + this.age;

            int childCount = this.children.size();
            if (childCount > 0) {
                text += ", children: " + this.children.get(0).name;

                for (int i = 1; i < childCount; i++) {
                    Human child = this.children.get(i);
                    text += ", " + child.name;
                }
            }

            return text;
        }
    }

}
In IntellJ it runs fine and I get the following output: Name: Grandpa1, sex: male, age: 45, children: Father, Mother Name: Grandpa2, sex: male, age: 85, children: Father, Mother Name: Grandma1, sex: female, age: 85, children: Father, Mother Name: Grandma2, sex: female, age: 35, children: Father, Mother Name: Father, sex: male, age: 25, children: Child1, Child2, Child3 Name: Mother, sex: female, age: 25, children: Child1, Child2, Child3 Name: Child1, sex: female, age: 5 Name: Child2, sex: female, age: 5 Name: Child3, sex: female, age: 5 Process finished with exit code 0 But it is still not fulfilling "The program should create objects and fill them with data to get two grandfathers, two grandmothers, one father, one mother, and three children. Then it should display all the Human objects on the screen." According to the validation. Help?