This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Encapsulate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Encapsulate" Watch "Encapsulate" New topic
Author

Encapsulate

Mike Shn
Ranch Hand

Joined: May 26, 2001
Posts: 149
I really not sure what encapsulate means. As I understand that when data is encapsulate that means that data is hidden(like private) .. Right?
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
Yes. It means to keep hidden things you don't want the outside world to know about, and just provide a public API (application programming interface) for the outside world to use.
That way, since you've kept your internal implementation private, you are free to change it later and no one has to know about that change. As long as the API stays the same, users of your class will continue to use your object just as they always have.


Rob
SCJP 1.4
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4442
    
    5

Here's an article from JavaWorld that differentiates between encapsulation and information hiding: http://www.javaworld.com/javaworld/jw-05-2001/jw-0518-encapsulation-p2.html
Junilu
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Hello,
The article recommended by Junilu is a great article on this topic. I highly recommend reading it.
Good Luck,
-Dirk Schreckmann


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Encapsulate
 
Similar Threads
Parsing values to a 2D array
ValueObject pattern question
Set Struts form bean data
Exceptions
Class: It's all about functionality.