Written by the Fiveable Content Team โข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโขWritten by the Fiveable Content Team โข Last updated September 2025
Definition
A getter method is a type of method in object-oriented programming that is used to retrieve the value of a private instance variable. It typically starts with the prefix "get" followed by the name of the variable it retrieves.
Related terms
Private Instance Variable: A private instance variable is a variable that can only be accessed within its own class. It stores data specific to each object created from that class.
A method is a set of instructions or actions performed on objects in order to achieve certain results.
Instance: An instance refers to an individual occurrence or example of a class, where each instance has its own set of values for variables defined in that class.