In java all methods are pass by value.But today i learnt that constructors are pass by reference.
// Attack the internals of a Period instance
Date start = new Date();
Date end = new Date();
Period p = new Period(start, end);
end.setYear(78); // Modifies internals of p!
This works and is able to edit the private fields.
What is the reason of this decision? or am i missing something?