According to Encapsulation fields should be private and public getter-setters.

But using setter there is a way that another class can alter the value of private field, So what should be the way to protect fields.

Please consider this class for discussion : 

```
    class Emp {

    private String name;
    private int age;

    public Emp() {}

    // getters and setters

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}

```