AP® Computer Science A glossary

Encapsulation

Also called: data encapsulation, information hiding

Course: AP® Computer Science A Shows up in: Unit 3: Class Creation

Keeping the implementation details of a class hidden from other classes, mainly by making instance variables private.

Appears in the course and exam description (CED): 3.3.A.13.3.A.5

Other classes use the public methods and never touch the data directly, so the class controls its own values. A mutator can refuse bad values, and the class can change how it stores data without breaking client code.

Learn it properly, with a checkpoint 3.3 Anatomy of a Class

Related terms

Was this page helpful?

No names are ever shown, and every public comment is checked by us first. Please do not include personal details. To get a reply, email [email protected].

↑ Top

Enlarged view of the selected figure