Question: what is getter and setter class?
Answer: Getters and setters are used to protect your data, particularly when creating classes. For each instance variable, a getter method returns its value while a setter method sets or updates its value. ... The getter method returns the value of the attribute. The setter method takes a parameter and assigns it to the attribute.