Jul 9 2010
Passing Primitive Data Values
- 1 Comment
Java Programming Tutorial: Passing Primitive Data Values
When the actual parameter is a variable of a primitive data type, the value of the variable is copied to the formal parameter at method invocation. Since formal parameters are local to the method, any changes made to the formal parameter will not be reflected in the actual parameter after the call completes.
Note that the actual parameter can be an expression that is evaluated first, and the resulting value is then passed.
Type conversions between actual and formal parameters of primitive data types are similar to those for numeric assignment conversions (i.e., widening primitive conversions are implicitly applied).
[...] integrity constraint—usually just called a domain constraint—is a rule that defines these legal values. It might, of course, be necessary to define more than one domain constraint to describe a domain [...]