# Setter

A method that validates or changes an object's stored value.

## What is **Setter** in Java?

**Setter** — A method that validates or changes an object's stored value.

```java
class Thermostat {
    private int temperature;

    int getTemperature() {
        return temperature;
    }

    void setTemperature(int temperature) {
        this.temperature = temperature;
    }
}
```

Level: Journeyman · [More Java terms at this level](https://www.ask-codey.com/glossary/subjects/java/journeyman)

Updated: September 27, 2026

## In other subjects

- [Setter in C#](https://www.ask-codey.com/glossary/setter-c-sharp)
- [Setter in JavaScript](https://www.ask-codey.com/glossary/setter-javascript)
- [Setter in OOP](https://www.ask-codey.com/glossary/setter-oop)

Source: https://www.ask-codey.com/glossary/setter
