Free Salesforce Developers Tutorials >

Chapter 15 - Visualforce >

Getter, Setter Method Part 1

Getter, Setter Method Part 1

What You’ll Learn


S2 Labs

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.

salesforce-developer

Download Study Material

Get access to exclusive study material for Salesforce Certification and ace your exams!

Download Now

Our Salesforce Certification Courses

Hey there! Glad you made it through our Salesforce Developer Training for beginners . But wait! We've got some high-in-demand Salesforce courses for you to take your Salesforce skills to the next level, making you a desired professional in the Salesforce job market.

Post a Comment

Your email address will not be published. Required fields are marked *