This method accesses the private fields of
harry, which is not surprising. It also accesses the private fields of
boss. This is legal because
boss is an object of type
Employee, and a method of the
Employee class is permitted to access the private fields of any object of type
If access privilege is not class-based, then it's impossible to compare two objects of the same class, because there is no way to compare the content of them.
Share this highlighthttp://www.safaribooksonline.com/a/core-java-volume/15364205/