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 2007-10-25 by Roedy Green ©1996-2008 Canadian Mind Products
index page for letter ⇒ 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)
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
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.59] The information on this page is for non-military use only.
You are visitor number 16,064. Military use includes use by defence contractors.
You can get a fresh 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