This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 4456
    
    6

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