Click here for the codes of the above examples.

Every instance (i.e., object) of a class contains one copy of each instance variable

Instance variables typically declared private

Declaring instance private is known as data hiding or information hiding

private variables are encapsulated (hidden) in the object and can be accessed only by methods of the object’s class