File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can we achieve data hiding withe the help of encapsulation...

 
rahul S Sharma
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Can we say that we can achieve data hiding with the help of encapsulation...?? please correct me if I am wrong....
regards....
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, you can hide your own implementation from world.
 
rahul S Sharma
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But i have read at so many places that encapsulation and information hiding are two different things. According to my understanding,
encapsulation is the mechanism that binds together code an data it manipulates.
Information hiding is hiding the data by using access specifiers like private, protected or default, so how can we relate encapsulation and information hiding.
I am very much confuse in these concepts. Please help me to make clear understanding of these concepts.
thanks in advance
 
chen logos
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public :any class in any package can access;
privatenly members in the same class can access directly;
protected: subclass or class in the same package can access directly.
 
rahul S Sharma
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mr. Chen,
Welcome to ranch, i appreciate your words that you have written but i don't think this is the answer of my question...
 
Stephan van Hulst
Bartender
Pie
Posts: 4846
34
Chrome Netbeans IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Encapsulation and data hiding in Java are the same thing.
 
rahul S Sharma
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mr. Stephan,
Could you please tell me how?
 
Stephan van Hulst
Bartender
Pie
Posts: 4846
34
Chrome Netbeans IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean how? They are two different terms that refer to the same thing: Restricting the visibility of members so that they are only used by the classes responsible for them.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic