Create ClassHierarchy.java

Used the code which was provided in the tutorial