aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Dan's definition of encapsulated class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Dan Watch "Dan New topic
Author

Dan's definition of encapsulated class

Barkat Mardhani
Ranch Hand

Joined: Aug 05, 2002
Posts: 787
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.

Is that universally accepted definition?
P Veer
Greenhorn

Joined: Oct 21, 2003
Posts: 9
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.


maverickthinker
P Veer
Greenhorn

Joined: Oct 21, 2003
Posts: 9
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dan's definition of encapsulated class