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

Can we have any code between try and finally blocks?

643


Why can't you declare a class as protected?

693


What is regex in java?

602


What is exception hierarchy in java?

663


What is class and its types?

632






How do you declare an empty string?

721


Why Java is not pure Object Oriented language?

749


Can abstract class have private constructor?

585


Does string isempty check for null?

673


What is synchronization and why is it important in java programming?

566


How big is a gigabyte?

713


How do you sort arrays in java?

609


What are java packages? What is the significance of packages?

653


What is string english?

644


Differentiate between stringbuffer and stringbuilder in java.

632