The reason Java acts as though it builds an isolating fence around each method's parameters is that Java reserves a chunk of memory for each parameter every time that the method is called. Java copies argument values into those reserved chunks:
Memory reserved Memory that supplies a value for for a variable in a corresponding parametern in calling program called program | | v v *------* Copy operation *------* | | ---------------------> | | *------* *------*
In the movieRating
example, a new chunk of memory is reserved for
each of the integer parameters, s
, a
, and d
. Argument
values are copied into those chunks.