equals method compares object reference by default (as implemented by Object class)

Override equals if you want to compare based on certain class specific attributes

    public boolean equals(Object o) {
        //check instanceof before doing anything
        if (o instanceof Foo) {
            Foo t = (Foo)o;
            if (this.empno == t.getEmpno()) {
                return true;
            }
        } 
        return false;
    }

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-3) was last changed on 10-Apr-2005 18:48 by 68.199.133.117