Passing Parameter in Methods
Definition:
- Parameter: the variables in the method header.
It looks like a port on the computer for you to insert a USB drive or
the hole on the COKE machine for you to insert coins.
- Argument: the information attached from caller.
It looks like the USB drive for you to insert to a computer or
the coins to use to insert to machine.
- pass by value:
The parameter & argument are located at the different memory spaces.
You copy the value of argument to parameter.
- pass by reference:
The parameter & argument locate at the same spot.
For example, Pass
an array to a method.
![](parame1.jpg)