public class Test { public static void main(String[] args) { BinaryTree root = new BinaryTree<>("William"); BinaryTree mom = new BinaryTree<>("Diana"); BinaryTree dad = new BinaryTree<>("Charles"); BinaryTree mgm = new BinaryTree<>("Frances"); BinaryTree mgf = new BinaryTree<>("Edward"); BinaryTree fgm = new BinaryTree<>("Elizabeth"); BinaryTree fgf = new BinaryTree<>("Philip"); root.setLeft(mom); root.setRight(dad); mom.setLeft(mgm); mom.setRight(mgf); dad.setLeft(fgm); dad.setRight(fgf); // Use the instance method definition System.out.println(root.getHeight()); // Use the static method definition System.out.println(BinaryTree.getHeight(root)); } }