I have the following code in my dto class.
public void setBillDate(Date billDate) {
this.billDate = billDate;
}
And I get an error in s
Date is mutableand you are not creating a copy of Date that came in to you are parameter. So if the client code will change the value of the Date object, it will affect your class too.
Solution is to create a copy of Date
public setBillDate(Date billDate){
this.billDate = new Date(billDate.getTime());
}