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.


The probable answer is that the designer of the visibility model considers that any developer working in a class has to master the implementation of the whole class.

But this is a bad idea. This encourages bad practice. A developer accessing a field of Person, in the class Person, does not have to know the implementation of the whole class. The good practice is to use the accessor, without having to know what operations the accessor does.