The following figure illustrates a bicycle modeled as a software object. The software bicycle would also have methods to brake, change the pedal cadence, and change gears. Anything that an object does not know or cannot do is excluded from the object. Thus there are no variables or methods for those states and behaviors in the bicycle class. As you can see from the diagrams, the object's variables make up the center or nucleus of the object.
Methods surround and hide the object's nucleus from other objects in the program.
Packaging an object's variables within the protective custody of its methods is called encapsulation. Typically, encapsulation is used to hide unimportant implementation details from other objects. When you want to change gears on your bicycle, you don't need to know how the gear mechanism works, you just need to know which lever to move. Similarly in software programs, you don't need to know how a class is implemented, you just need to know which methods to invoke. Thus, the implementation details can change at any time without affecting other parts of the program.