File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes can we achieve data hiding withe the help of encapsulation... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "can we achieve data hiding withe the help of encapsulation..." Watch "can we achieve data hiding withe the help of encapsulation..." New topic
Author

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

rahul S Sharma
Greenhorn

Joined: Jun 08, 2011
Posts: 21
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

Joined: Jan 28, 2008
Posts: 5575

yes, you can hide your own implementation from world.
rahul S Sharma
Greenhorn

Joined: Jun 08, 2011
Posts: 21
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

Joined: Jun 16, 2011
Posts: 1
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

Joined: Jun 08, 2011
Posts: 21
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

Joined: Sep 20, 2010
Posts: 3603
    
  14

Encapsulation and data hiding in Java are the same thing.
rahul S Sharma
Greenhorn

Joined: Jun 08, 2011
Posts: 21
Mr. Stephan,
Could you please tell me how?
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3603
    
  14

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.
 
wood burning stoves
 
subject: can we achieve data hiding withe the help of encapsulation...
 
Similar Threads
What is encapsulation
OOPS Concepts - Redefined(Confirmation required)
Encapsulation vs Data/information hiding
DataHiding and Encapsulation??
BJO - information hiding v/s encapsulation