most of others can get the right answer but gave me different versions of explain that confused me even more. I think your explaination is to the point. it reminds me of an example i tried b4.
in this example, an object Day d works as Function argument:
static void changeDay(Day d, int yearsDelayed)
//won't work
{ int month = d.getMonth();
int day = d.getDay();
int year = d.getYear();}
d=new Day(year + yearsDelayed, month, day);
}
and suppose we call this function
ely = new Day(1999,10,15);
changeDay(ely,2);
"ely" will not have the correct date i want because the function only did something on the "copy of the object" but not on the object itself, right?
in this example, an object Day d works as Function argument:
static void changeDay(Day d, int yearsDelayed)
//won't work
{ int month = d.getMonth();
int day = d.getDay();
int year = d.getYear();}
d=new Day(year + yearsDelayed, month, day);
}
and suppose we call this function
ely = new Day(1999,10,15);
changeDay(ely,2);
"ely" will not have the correct date i want because the function only did something on the "copy of the object" but not on the object itself, right?