I\'m adding an instance variable to a class \"Person\" which is a reference type (\"Date\", which I have written a class for). In the constructor for my Person class, I am there
You can do this:
this.birthday = new Date(birthday.getTime());
This creates a copy of the date object. Since a Date can be modified it is dangerous to use the same object, which you'd be doing if you just copied the reference:
this.birthday = birthday;
That would allow the outside world to change your birthday without you knowing about it.