Scope and pass-by-value

A variable's scope is the area of code where it can be used: that of a local variable is limited to the {} block where it is declared. Java always passes arguments by value: a method receives a copy, and for an object, a copy of the reference, so it can modify the object but not reassign the caller's variable.

Related concepts

The whole glossary