Java: Getters, Setters & Access Control

Report a typo

In the below Java code snippet, which of the following statements are true regarding the use of 'getters', 'setters', and the private access modifier?

public class Car {
    private String color;

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }
}
Select one or more options from the list
___

Create a free account to access the full topic