What is an Encapsulation in Java ?

Encapsulation is a mechanism that binds together code and data it manipulates, and keeps both safe from outside interface and misuse. One way to think about encapsulation is as a protective wrapper that prevents code and data from being arbitrarily accessed by other code defined outside the wrapper.Inheritance defines "is-a" hierarchy among classes in which one subclass inherits from one or more generalised super classes.


Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email