Part-1 : Tree in Java.