aspose file tools
The moose likes Java in General and the fly likes Doubt in encapsulation. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Doubt in encapsulation." Watch "Doubt in encapsulation." New topic
Author

Doubt in encapsulation.

Praveen Kumar
Ranch Hand

Joined: Nov 06, 2006
Posts: 133
Hi ..


The main benefit of encapsulation is the ability to modify our implemented code without breaking the code of others who use our code. With this feature Encapsulation gives maintainability, flexibility and extensibility to our code.

Can you please explain me with an example ?.

Thanks
Praveen


Kevin Workman
Ranch Hand

Joined: Sep 28, 2010
Posts: 151
http://www.google.com/search?q=examples+of+encapsulation
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 576

The Java library is perhaps the best example ... Take for instance the java.util.HashMap class

Its been around for quite a long time, but the interface the it has provided to its users has remained stable.
However it has under gone a lot of internal changes to make it more efficient, faster...

By encapsulating away these details of how it works internally, it has shielded the user from any problems.

Kind of simplified but I hope it gets the point across ....


Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in encapsulation.
 
Similar Threads
Anybody jus started preparation for SCJP?
Enacpusaltion In Java can anybody explain with small practical example
WA #1.....word association
getters and setters provide abstraction or encapsulation ?
Encapsulation ?