how to ensure mutability of class when it is composed of mutable attributes : To make a class mutable when it consists of mutable attribute(s), we should return defensive copies of the mutable attributes.
Consider below mentioned class
    
    class User {

    private String firstName;
    private String lastName;
    private Date dateOfBirth;

    // standard getter and setter for firstName and lastName 

    public void setdateOfBirth(Date dateOfBirth){}
     this.dateOfBirth = new Date(dateOfBirth.getTime());
    
    public Date getDateOfBirth(){
       return new Date(dateOfBirth.getTime());
       }
    }

Can we say that if date attribute is set and returned using the above mentioned getters and setter method, it would help in creating the class as immutable and would help in saving the internal state of user class for dateOfBirth field?