whats wrong in this code
package com.codegym.task.task07.task0724;
/*
Family census
*/
public class Solution {
public static void main(String[] args) {
Human grandfather1 = new Human("GrandFather1", true, 70);
Human grandmother1 = new Human("GrandFather1", true, 70);
Human human0 = new Human("hamza",true,20);
Human human1 = new Human("hamza",true,20);
Human human2 = new Human("hamza",true,20);
Human human3 = new Human("hamza",true,20);
Human human4 = new Human("hamza",true,20,grandfather1,grandmother1);
Human human5 = new Human("hamza",true,20,grandfather1,grandmother1);
Human human6 = new Human("hamza",true,20,grandfather1,grandmother1);
Human human7 = new Human("hamza",true,20,grandfather1,grandmother1);
Human human8 = new Human("hamza",true,20,grandfather1,grandmother1);
System.out.println(human0.toString());
System.out.println(human1.toString());
System.out.println(human2.toString());
System.out.println(human3.toString());
System.out.println(human4.toString());
System.out.println(human5.toString());
System.out.println(human6.toString());
System.out.println(human7.toString());
System.out.println(human8.toString());
}
public static class Human {
String name;
boolean sex;
int age;
static Human father;
static Human mother;
public Human(String name, boolean sex, int age){
this.name=name;
this.sex=sex;
this.age=age;
}
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 += "Name: " + this.name;
text += ", sex: " + (this.sex ? "male" : "female");
text += ", age: " + this.age;
if (this.father != null)
text += ", father: " + this.father.name;
if (this.mother != null)
text += ", mother: " + this.mother.name;
return text;
}
}
}