public class Child extends Parent
{
    private int childInstanceVar;

    /*
     * Use this as a model for equals method in a class
     * that DOES extend another class
     */
    public boolean equals(Object otherObj)
    {
        // can't be equal if otherObj is null
        if (otherObj == null)
        {
            return false;
        }
        
        // can't be equal if otherObj is not Child
        if (getClass() != otherObj.getClass())
        {
            return false;
        }
        
        // otherObj is type Child - cast to Child object
        Child otherChild = (Child) otherObj;
        
        // call base-class equals method, then check instance
        // variables for this class
        return (super.equals(otherChild) &&
                (childInstanceVar == otherChild.childInstanceVar));
    }
}