TreeDemo.java.html

  1  /**
  2     This class demonstrates the tree class.
  3  */
  4  public class TreeDemo
  5  {
  6     public static void main(String[] args)
  7     {
  8        Tree t1 = new Tree("Anne");
  9        Tree t2 = new Tree("Peter");
 10        t1.addSubtree(t2);
 11        Tree t3 = new Tree("Zara");
 12        t1.addSubtree(t3);
 13        Tree t4 = new Tree("Savannah");
 14        t2.addSubtree(t4);
 15        System.out.println("Size: " + t1.size());
 16     }
 17  }