This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

difference between abstraction and encapsulation

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i cound not understand the difference between abstraction and encapsulation. please help
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!!

Regards,
- Nitin
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mahi
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic