public class TreePrint1 { public static void main(String[] args) { Node root = new Node(15, new Node(12, new Node(6), new Node(14) ), new Node(40, new Node(25), new Node(80) ) ); //Print the tree. print(root); System.exit(0); } //Print the tree rooted at node. private static void print(Node node) { if (node != null) { print(node.left); System.out.println(node.value); print(node.right); } } } class Node { int value; Node left; Node right; Node(int value, Node left, Node right) { this.value = value; this.left = left; this.right = right; } Node(int value) { this.value = value; //this.left and this.right implicitly initialized to null } };