wood burning stoves*
The moose likes Beginning Java and the fly likes Encapsulation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Encapsulation " Watch "Encapsulation " New topic
Author

Encapsulation

Sham Grandhe
Ranch Hand

Joined: Dec 16, 2003
Posts: 73
hai friends,

plz send a good definition for encapsulation.
michelle anderson
Greenhorn

Joined: Sep 13, 2004
Posts: 3
Encapsulation is a technique for hiding data and behavior within a class;it helps you write clean, modular software.

Hope this helps.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

In practice, encapsulation basically means making variables private and allowing them to be accessed and/or manipulated only through methods.

This is particularly useful where polymorphism is concerned. See thread http://www.coderanch.com/t/246221/java-programmer-SCJP/certification/Good-you-figure-it-out
[ September 13, 2004: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
"Information hiding" is a concept that I Googled once and found references back into the 1970s. It's key to good modularity in procedural or OO languages. A C module can hide its algorithms, but an object can also hide and protect its data so thoroughly that no external chunk of code can mess it up. Encapsulation is "improved information hiding." (Not meant to be a closed definition ... does it mean more to you?)


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Sham Grandhe
Ranch Hand

Joined: Dec 16, 2003
Posts: 73
thank you friends this will help me a lot.

with regards
shyam.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Encapsulation
 
Similar Threads
acronym atrocity
Field hiding
4 key points about Oops
inheritance violates encapsulation
WA #1.....word association