encapsulation? Your definition is correct. It is data hiding because the class uses public getters/setting to retrieve/assign "private" variables. And the class is practically a JavaBean.
Ravi Kiran V wrote:
From this i understand that Encapsulation is nothing but a java bean with private properties and public methods .
In OO, encapsulation is a little more than that. When you encapsulate something you get an inside and an outside. The outside is called a data abstraction, or the type. The inside is called information hiding, or the implementation. So in principle encapsulation is the separation of a visible type from a hidden implementation, or the division of something into "what" you can see and use, from "how" it's done. Most importantly the type and the implementation become independent of each other and can be changed separately.
The main units of encapsulation in Java is the class, the enum and the interface (each with somewhat different encapsulation properties). The type is the signature and behaviour of all non-private methods and fields of these language elements. The implementation is the code inside including private methods and fields.
Encapsulation is very important in Java. It's at the very heart of OO programming. Defining appropriate types and cleverly hiding implementation is the process that drives the design and development of Java programs.