Experience Salesforce
Getter, Setter Method Part 1
What You’ll Learn
- What Is Getter And Setter Methods In Salesforce?
- How To Use Getter And Setter In Salesforce?
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.
Next TopicNeed Extra Support? Our FREE study materials have got you covered.
Our expert-prepared study materials provide the answers you need. Clear your doubts and improve your skills with detailed notes from industry professionals.