Getter, Setter Method Part 1
Chapter Topics
- What is Visualforce in Salesforce?
- Architecture of Visualforce Page
- Standard Controller in Visualforce
- How to create View Page in Visualforce?
- How To Create Edit Page In Visualforce?
- Custom Controller in Salesforce
- Getter, Setter Method Part 1
- Getter, Setter Method Part 2
- Apex Page Message in Visualforce
- Controller Extensions Part 1
- Controller Extensions Part 2
- Using Controller Extension with Custom Controller
- Order of Execution
- Tabs in Visualforce
- System Mode in Visualforce
What Is Getter And Setter Methods In Salesforce?
Getter and Setter methods are used to get and set the value of properties of a class, respectively. Here is the below example sample code for getter Setter methods.
How To Use Getter And Setter In Salesforce?
public class MyClass {
private String myProperty;
public String getMyProperty() {
return myProperty;
}
public void setMyProperty(String value) {
myProperty = value;
}
}
In the above code, setMyProperty method is used to set the myProperty property value. getMyProperty method is used to get the myProperty value.

Join our newsletter: Get daily update on Salesforce career insights & news!
Join Now!
Need more support?
Get a head start with our FREE study notes!
Learn more and get all the answers you need at zero cost. Improve your skills using our detailed notes prepared by industry experts to help you excel.