title: Family tree, cannot resolve child
body: <p>I'm clueless with this task. I need to make family tree like on this </p>
  
  <p><a href="https://i.stack.imgur.com/kFbhi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kFbhi.png" alt="enter image description here"></a></p>
  
  <p>But I cannot solve child in Main.java. With every name I have to write null to child. </p>
  
  <p>Here is my code : <a href="https://www.jdoodle.com/embed/v0/Q12" rel="nofollow noreferrer">Main.java</a>.
  Second file: <a href="https://www.jdoodle.com/embed/v0/Q0Z" rel="nofollow noreferrer">Osoba.java</a></p>
  
  <pre><code>public class Main {
  
      public static void main(String[] args) {
  
          Osoba abraham = new Osoba("Abraham Simpson", null, null, null, null, null, null, null);
          Osoba penelope = new Osoba("Penelope Olsen", null, null, null, null, null, null,null);
          Osoba pan = new Osoba("Pan Bouvier", null, null, null, null, null,null,null);
          Osoba jackie = new Osoba("Jackie Bouvier", null, null, null, null, null,null,null);
          Osoba herb = new Osoba("Herb Powers", abraham, penelope, null, null, null,null,null);
          Osoba homer = new Osoba("Homer Simpson", abraham, penelope, null, null, null,null,null);
          Osoba marge = new Osoba("Marge Simpson", pan, jackie, null, null, null,null,null);
          Osoba selma = new Osoba ("Selma Bouvier", pan, jackie, null, null, null,null,null);
          Osoba bart = new Osoba("Bart Simpson", homer, abraham, penelope,marge, pan,jackie,null);
  
          bart.sestavRodokmen();
          System.out.println();
          homer.sestavRodokmen();
      }
  }
  
  
  
  public class Osoba {
  
      private String name;
      private Osoba father;
      private Osoba dad_grandpa;
      private Osoba dad_grandma;
      private Osoba mother;
      private Osoba mom_grandpa;
      private Osoba mom_grandma;
      private Osoba child;
  
      public Osoba (String name, Osoba father, Osoba dad_grandpa, Osoba dad_grandma, Osoba mother, Osoba mom_grandpa, Osoba mom_grandma, Osoba child) {
          this.name = name;
          this.father = father;
          this.dad_grandpa = dad_grandpa;
          this.dad_grandma = dad_grandma;
          this.mother = mother;
          this.mom_grandpa = mom_grandpa;
          this.mom_grandma = mom_grandma;
          this.child = child;
      }
  
      private String rodokmen;
  
      public void sestavRodokmen () {
  
          System.out.println("Rodokmen pro osobu: " + name);
  
          System.out.println("Name: " + name);
          System.out.println("Father: "+ father);
          System.out.println("Grandfather: "+ dad_grandpa);
          System.out.println("Grandmother: "+ dad_grandma);
          System.out.println("Mother: "+ mother);
          System.out.println("Grandfather: "+ mom_grandpa);
          System.out.println("Grandmother: "+ mom_grandma);
          System.out.println("Child: "+ child);
  
          rodokmen = "";
          System.out.println(rodokmen);
      }
  
      @Override
      public String toString () {
          String a = "";
          if(mother != null &amp;&amp; father != null)
              a += name + "\n" + father + "\n" + mother +"\n" +"\n" + child;
          else
              a += name;
  
          return a;
      }
  }
  </code></pre>