Professional Documents
Culture Documents
Output
The Street Bob.
Old-school yet relevant.
Light on its feet with a hefty : 630 lbs.
3. Encapsulation
Encapsulation is a means of binding data variables and methods together
in a class. Only objects of the class can then be allowed to access these
entities. This is known as data hiding and helps in the insulation of data.
Example Program of Encapsulation in Java
class Encapsulate
{
obj.setName("Abi");
obj.setWeight(70);
obj.setHeight(178);
}
}
Output
My name: Abi
My height: 70
My weight: 178