Skip to content

Instantly share code, notes, and snippets.

@jerolba
Last active December 31, 2022 12:18
Show Gist options
  • Save jerolba/c8e5626d3886d2f986a7f8f159eab5a4 to your computer and use it in GitHub Desktop.
Save jerolba/c8e5626d3886d2f986a7f8f159eab5a4 to your computer and use it in GitHub Desktop.
Arrays are passed by value
public class ObjectArrayParameterByValue {
public static void main(String[] args) {
String[] data = { "Foo", "Bar" };
System.out.println(data[0]);
}
public void changeArray(String[] data) {
data[0] = "Changed";
}
}
@jmiguelr
Copy link

:-D He pillado justo el tweet en el minuto que ha estado vivo :-D .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment