public class Solution { public static void main(String[] args) { ArrayList<String> family=new ArrayList<String>(); Human wasya=new Human("Вася", true, 82); family.add(Human.wasya); // КАК ПРАВИЛЬНО ВНЕСТИ В СПИСОК ЭТИ ОБЪЕКТЫ? Human toma=new Human("Тома", false, 78); Human gena=new Human("Гена", true, 80); Human olya=new Human("Оля", false, 76); Human andrey=new Human("Андрей", true, 55, wasya, toma);// Лена Слава Женя Настя Human lena=new Human("Лена", false, 50, gena, olya); Human slava=new Human("Слава", true, 30, andrey, lena); Human evgen=new Human("Женя", true, 25, andrey, lena); Human nastya=new Human("Настя", true, 24, andrey, lena); for (String n: family){ System.out.println(n); } } 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; } } }