Solved

Oop Concepts

Posted on 2002-04-30
3
833 Views
Last Modified: 2013-11-23
what is Abstraction  and Encapsulation w.r.t object oriented langauges..and what is the use of implementing these concepts in programming....please explain with some good examples.??

what difference does it makes if we do use and if we do not use the above mentioned concepts in our programming..??
0
Comment
Question by:yrrm
3 Comments
 
LVL 2

Expert Comment

by:CSuvendra
ID: 6979731
0
 
LVL 1

Accepted Solution

by:
googlyralph earned 75 total points
ID: 6979789
Abstraction:

If you want to get from town A to town B, you would get a map. The map doesnt contain absolutly everything (every tree, blade of grass and insect on the way), but it does give you enough information about how to make your journey, ie foot paths and roads. This is abstraction, you "see" enough to do what you need to.

Encapsulation:

Think of black boxes, you cant see whats inside them (nor do oyu want/need to), you just know that by giving that black box X, then Y gets returned. This means that when somehting changes, you can change the internals of a black box, and no other code need no, beacause as long as the inputs and outputs are the same, no one will ever notice. This means that 10 people working on one project can all work on code, and as long as the design was sound, and each black box works in the way it was origianlly designed.

What difference:

The difference is that is how Java was intended to be used. And every Java programmer knows this, and so it makes it easier for several people to work on a project if you are all going about problems in a similar way. I know that at first it seems backwards and stupid, but as you go deeper into the language you start to see good reasons. When you write big system, you find that these approaches do work, so just stick with them.

GR.
0
 
LVL 35

Expert Comment

by:girionis
ID: 6979799
 Take a look at Sun's excellent tutorial on abstraction, polymorphism and encapsulation: http://java.sun.com/docs/books/tutorial/java/concepts/
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
eclipse shortcuts 9 55
DBGrid or StringGrid ? 6 89
Configure a Bean in an XML file 4 32
how to install java on RHEL image on EC2 4 27
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question