Make pure immutable class
<p>I have following classes :</p>

<p><strong>Emp.java</strong></p>

<pre><code>final public class Emp {

    private Integer id;
    private String name;
    private Department department;

    public Emp(Integer id, String name, Department department) {
        this.id = id;
        this.name = name;
        this.department = department;
    }

    public Department getDepartment() {
        return department;
    }

    public Integer getId() {
        return id;
    }

    public String getName() {
        return name;
    }
}
</code></pre>

<p><strong>Department.java</strong></p>

<pre><code>public class Department {

    private Integer id;
    private String name;

    public Department(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }
}
</code></pre>

<p><strong>EmployeeTest.java</strong></p>

<pre><code>public class EmployeeTest {

    public static void main(String args[]) {
        Department dept1 = new Department(1, "dept1");
        Emp emp = new Emp(1, "emp1", dept1);
        emp.getDepartment().setName("dept2");
        System.out.println("emp = "+emp);

    }
}
</code></pre>

<p>Here <strong>Emp</strong> class is not purely an immutable class because somehow I am able to change the values of <strong>Department</strong> (as shown in the example).</p>

<p>What are the best possible changes which will make <strong>Emp</strong> class a pure Immutable class ?</p>
