Encapsulation in Java or object oriented programming language is a concept which enforce protecting variables, functions from outside of class, in order to better manage that piece of code and having least impact or no impact on other parts of program duec to change in protected code. Encapsulation in Java is visible at different places and Java language itself provide many construct to encapsulate members. You can completely encapsulate a member be it a variable or method in Java by using private keyword and you can even achieve a lesser degree of encapsulation in Java by using other access modifier like protected or public. true value of encapsulation is realized in an environment which is prone to change a lot and we know that in software requirements changes every day at that time if you have your code well encapsulated you can better manage risk with change in requirement. Along with abstaction in java and polymorphism in Java, Encapsulation is a must know concept. In this java tutorial we will see How to use encapsulation in Java, advantage and disadvantage of Encapsulation and various design patterns and real life problems which makes use of Encapsulation object oriented concept. If you are looking for a quick guide on both OOPS and SOLID design principle in Java than you may find 10 Object Oriented Design principles Java programmer should know interesting.
Jumat, 09 Maret 2012
core java
What is Encapsulation in Java and OOPS with Example
Read more »
0 Response to "What is Encapsulation in Java and OOPS with Example"
Posting Komentar