class Person { int id ; String firstName ; String laststName ; } class AnotherPerson { int id ; String firstName ; String lastName ; public void setValue(int idP) { id = idP ; } public void setValue(int idP, String firstNameP ) { id = idP ; firstName = firstNameP ; } public void setValue(int idP , String firstNameP , String lastNameP ) { id = idP ; firstName = firstNameP ; lastName = lastNameP ; } public String toString() { return( "id: " + id + " Name: " + firstName + " " + lastName ) ; } } public class SingleHierarchy { public static void main( String args[] ) { Person personObject1 = new Person() ; //Uses the Object class toString method System.out.println( personObject1 ) ; System.out.println( Integer.toHexString(personObject1.hashCode()) ) ; AnotherPerson personObject2 = new AnotherPerson() ; //Method Overloading personObject2.setValue( 1 ) ; personObject2.setValue( 1 , "Jack" ) ; personObject2.setValue( 1 , "Jack" , "Dempsey" ) ; //Uses the AnotherPerson class toString method //Method Overriding System.out.println( personObject2 ) ; } }