File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes difference between abstraction and encapsulation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "difference between abstraction and encapsulation" Watch "difference between abstraction and encapsulation" New topic

difference between abstraction and encapsulation

naveen jayant

Joined: Jun 11, 2007
Posts: 6
i cound not understand the difference between abstraction and encapsulation. please help
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Hi, have you tried Google or Wikipedia or books you have on hand? If you can describe what you think they mean, we'll talk about what you have, but we're not likely to do the whole job for you. Let us know what you find!

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
dhwani mathur
Ranch Hand

Joined: May 08, 2007
Posts: 621
well,what i can i say in difference about abstraction and encapsulation is

Abstraction:-This is just showing the essential features in your program.

Encapsulation:-This is hiding all the important features in program ie encapsulating the important data.

I hope you understand.
nitin goswami

Joined: Mar 01, 2005
Posts: 25
Abstraction: For example, A 'Person' is not an 'Animal'. We can prove it by abstraction.
Drawing a line and Defining an Object's Property and Behaviour is Abstraction.

Encapsulation: After drawing a line and defining the properties and behaviour, now Hidding internal details of particular behaviour and hidding certain properties is encapsulation. Example: if you kick a dog he bites. This is the behaviour of a dog and we should be least bothered about how he will bite rather should be conceren about the fact that if we kick him, he bites.

This is my understanding about these concepts. May this helps.

Comments or Suggestions are always welcome!!!

- Nitin
Mahi Rahman

Joined: Feb 16, 2007
Posts: 21
An abstract class doesn't have any body. It's an "agreement" that the class (where this abstract class is implemented) is going to use all the methods of abstract class. It it does not do so then that also has to be an abstract class.

On the other hand, encapsulation is hiding the program logic from the end-user. Using encapsulation improves the security and privacy of the system.

For more understanding, I suggest you read a good object oriented text book.

Regards, Mahi.
naveen jayant

Joined: Jun 11, 2007
Posts: 6
Thanks Mahi
I agree. Here's the link:
subject: difference between abstraction and encapsulation
jQuery in Action, 3rd edition