Skip to content

Instantly share code, notes, and snippets.

@jnizet
Created January 13, 2014 08:52
Show Gist options
  • Save jnizet/8396773 to your computer and use it in GitHub Desktop.
Save jnizet/8396773 to your computer and use it in GitHub Desktop.
import java.util.Arrays;
public class ArrayTest {
public static void main(String[] args) {
int[] array = new int[] {1, 2, 3, 4};
foo(array);
System.out.println("array in main : " + Arrays.toString(array));
}
private static void foo(int[] array) {
// ignore the argument, and assign a new value to it
array = new int[] {5, 6, 7, 8};
System.out.println("array in foo : " + Arrays.toString(array));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment