| 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
|
 |
 |
|
|
subject: Doubt in encapsulation.
|
|
|