Language syntax
Java pass-by-value
Parameters receive copied values; a copied reference can identify a shared mutable object.
Formal Syntax & Structure
java syntaxjava
static void adjust(int[] stock) { ... }Working Example
Example Snippetjava
public class Main { static void adjust(int[] stock) { stock[0] = 8; stock = new int[] {99}; System.out.println(stock[0]); } public static void main(String[] args) { int[] stock = {3}; adjust(stock); System.out.println(stock[0]); }}