Why can I access my private variables of the “other” object directly, in my equals(Object o) method

Private data is accessible by any instance of that class, even if one instance of class A is accessing the private members of another instance of A. It’s important to remember that that access modifiers (private, protected, public) are controlling class access, not instance access.

Leave a Comment