Encapsulation in java


Features of object oriented programming:

Encapsulation:
                    Encapsulation is nothing but protecting the information.

                   For example , in real life we have capsule, inside that  medicine is present. Medicine is protected inside the capsule.If we consider the previous example that is discussed in abstraction [ previous post] , the parts inside the remote are protected by the remote wrapper. We wont be able to see the parts inside the remote.Likewise in java, variables are protected inside the class. This concept is called Encapsulation.

Encapsulation is achieved by means of  access specifiers [Will discuss in the upcoming posts]


Previous
Next Post »