This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
All three classes are tightly encapsulated, because the data members are private. A tightly encapsulated class can have public accessor and mutator methods, but it is not required to have those methods.
Yes.I think so.Accessor and mutator methods are only used to get access of these private data members outside the class.If they too are declared private or protected it doesn't make sense to write these additional methods.
Joined: Oct 21, 2003
It is not required to have those methods since they are only used to access private data members.If you want to restrict the access to private data members within the class there is no need for creating accesors and mutators.