Skip to content

Glossary: Java Basics

Encapsulation

Keeping an object's fields private and offering safe public methods instead. `Product` hides `stock`, so it only changes through `sell` and `restock`.

Where the book teaches it

Related terms

privateGetterField