Not quite. The purpose of setters and getters is to provide a way to retreive a field or set a field in a class. They should be named based on what they do (get or set). Usually the fields are declared private as the user does not need to know the implementation details of how they are stored internally. The user just needs to know what types they take or return or what action they perform.
private boolean switchSetting = false; // default to off
// later in the class define setters and getters to
// retrieve or modify the switch setting
public boolean getSwitchSetting() {
return switchSetting;
}
public void setOn (){ // you don't need an argument. Name says it all
this.switchSetting = true;
}
public void setOff() { // ditto
this.switchSetting = false;
}
Note above you could do something like this for setting the switch.
boolean ON = true;
boolean OFF = false;
public void setSwitch(boolean setting) {
this.switchSetting = setting;
}
// and later
object.setSwitch(ON);
// or
object.setSwitch(OFF);