A private instance variable is a data member that can only be accessed within its own class. Other classes cannot directly read or modify its value.
Related terms
Public instance variable: A public instance variable can be accessed and modified by any other class in addition to its own class.
Encapsulation: Encapsulation is an object-oriented programming concept that bundles data (instance variables) and methods (getter/setter methods) together within a class, providing control over how objects interact with each other.
Data hiding: Data hiding refers to the practice of encapsulating data (instance variables) within classes using access modifiers like "private," preventing direct access from outside code.