parameters : Java Glossary

go to home page P words local find full screen, hide local find menu Google search web for more information on this topic jump to foot of page translate this page with Babelfish punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all) ©1996-2009 2007-10-25 Roedy Green, Canadian Mind Products
parameters
parameters are always passed by value not by reference. The called method gets a copy of each primitive and a copy of the pointer to each object. The called method can therefore not change any local variables in the caller. However it can change the contents of objects (which includes strings and arrays) passed to it. Some people may argue that counts as call by reference, however a callee cannot make the callers variables point to different objects, just change the contents of objects. Objects are always accessed by reference, (literally via a reference) even when parameters are not involved. You can kludge call by reference by passing values back to your caller inside an array or by returning a freshly minted object full of values.

Difference Between Parameters and Arguments

Many people use the terms parameter and argument interchangeably, but they are different. In the definition of a method, you describe the parameter types and variable names by which they will be called inside the called method. When you invoke the method, the values you pass are called the arguments.

Parameters refer to the local names in the callee. Arguments refer to the values passed by the caller.

Learning More


CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/parameters.html J:\mindprod\jgloss\parameters.html
CMP logofeedback Please email your feedback for publication, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.191.100]
You are visitor number 28,057.