public final int numberOfNodes(){
  int n=0;
  if (root == null)   return n;
  for (Enumeration<TreeNode> e=elements(); e.hasMoreElements(); ) {
    e.nextElement();
    n++;
  }
  return n;
}

public final int numberOfNodes ( ) { int n = 0 ; if ( root == null ) return n ; for ( Enumeration < TreeNode > e = elements ( ) ; e . hasMoreElements ( ) ; ) { e . nextElement ( ) ; n ++ ; } return n ; }
counts and returns the number of nodes
