Parameter Passing
The file ChangingPeople.java
contains a program that illustrates parameter passing. The program
uses Person objects defined in the file
Person.java. Do the following:
- Trace the execution of the program using diagrams similar
to those in Display 5.13 of the text. Diagrams should have a "box" for each variable, and another for each instantiated object. Also show what you think will be printed by the program.
- Compile and run the program to see if your trace was correct.
If it was not correct, please explain where you made your mistake.
- Modify the changePeople method so that it does what the
documentation says it does; that is, the two Person objects passed in
as actual parameters are actually changed. That is, the output line starting "In main", the first person's data should be "Jack" and "101", and the second should be "Jill" and "21".
You must hand in this program along with your trace diagram today, in lab.