Properties are dedicated members of a class that hold state (data) and typically expose that state through controlled accessors such as getters and setters. This controlled access supports encapsulation by keeping the internal representation hidden while still allowing validation or other logic when values are read or written. Choices that instead describe behaviors (methods), control-flow constructs (loops), or general variables do not match the specific definition of a property.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What are getters and setters in object-oriented programming?
Open an interactive chat with Bash
What is encapsulation in object-oriented programming?
Open an interactive chat with Bash
How do properties differ from methods in object-oriented programming?