go to previous page   go to home page   go to next page


Call by Value

The type of parameter passing that Java uses is called call by value. Some programming languages use other methods of parameter passing, although call by value is the most common.

This is how call by value works:

  1. When the caller invokes a method, the caller provides a list of values (the actual parameters) in the parameter list.
  2. When the invoked method starts running, these values are copied to the formal parameters.
  3. The invoked method uses the formal parameters to access these copied values.
  4. Any change that the method makes to the value held in a formal parameter changes only that copy.
  5. The invoked method cannot use a formal parameter to send a value back to the caller.


(Review:) What is a primitive data type?