You are on page 1of 5

ABSTARCTION AND ENCAPSULATION

S.LAKSHMI PRABHA
1815053
ABSTRACTION

Abstraction is the concept of object-oriented programming that "shows" only essential


attributes and "hides" unnecessary information. The main purpose of abstraction is hiding
the unnecessary details from the users. It is one of the most important concepts of OOPs.

Advantages of Abstraction:

Abstraction makes code as readable and more simpler. Because complexity of code will be
hidden and also makes code from longer to small , because abstraction doesn't show
unnecessary things.
Realtime Examples of Abstraction :
• We all use an ATM machine for cash withdrawal, money transfer, retrieve min-
statement, in our daily life.

• But we don't know internally what things are happening inside ATM machine

• when you insert an ATM card for performing any kind of operation. 
ENCAPSULATION

• In object-oriented computer programming languages , Encapsulation is a process of


wrapping code and data together into a single unit

• Many programming languages use encapsulation frequently in the form of classes.

• The main disadvantage of encapsulation in Java is it increases the length of the code
and slows shutdown execution.

• Advantages are It reduces human errors , simplifies the maintenance of the


application , makes the application easier to understand.
Realtime Examples of Encapsulation:

• The Real time example of encapsulation is a capsule. Basically, capsule encapsulates


several combinations of medicine.

• If combinations of medicine are variables and methods then the capsule will act as a
class and the whole process is called Encapsulation.

You might also like