title: Returning an inorder string of a Tree
body: <p><em>EDIT</em> This has been resolved by using StringBuilder as suggested in this thread. Thank you :D</p>
  
  <p>Hello, </p>
  
  <p>I have a tree and am trying to return a String of the content in order. </p>
  
  <p>I can currently print out the tree with something like this: </p>
  
  <pre><code>    public void inOrder() {
          if (left != null) left.inOrder();
          System.out.print(content + " ");
          if (right != null) right.inOrder();
      }
  </code></pre>
  
  <p>But what I want to do is return the String (rather than print out each nodes content while recursing) and I can't work out how to do it. I tried many variations of the code below, but it just returns the last element it finds in the recursion. </p>
  
  <pre><code> public String inOrder(String string) {
          if (left != null) left.inOrder(string);
          string += content;
          if (right != null) right.inOrder(string);
  
          return string;
      }
  </code></pre>