can any one tell me what is advantage of encapsulation

Answer Posted / shalini

any programming lang. constitutes of two parts
1. logics 2. data
out of the above two, data is more important coz logics
lost can be rewritten but data once lost can never be
retrieved, hence data is more imp, but in the languages
like C and C++, there is a high chance of loosing the data
coz of the global variable concept, there is a very high
insecurity coz of global variables. So in order to overcum
the disadvantage of global var, encapsulation was
introduced, coz encapsulation eliminates the concepts of
global var, and the entire data is encapsulated at one
place, what u call it as class...hence encapsulation forms
the basis for OOPS concept

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is array and arraylist in java?

535


Where and how can you use a private constructor?

542


how to create constants in java?

612


What is generics in java interview questions?

543


What is a boolean field?

531






What is string example?

599


What is thread pool? How can we create thread pool in java?

628


What is the difference between overriding and overloading in OOPS.

567


What is the vector class in java programming?

569


What is the difference between the paint() and repaint() methods?

593


What is a lightweight component?

600


Which class should you use to obtain design information about an object in java programming?

651


What are different types of references?

536


Difference between static binding and dynamic binding?

573


What is the difference between a method and a procedure?

552