Skip to content

Instantly share code, notes, and snippets.

@charlesreid1
Created May 24, 2017 16:15
Show Gist options
  • Save charlesreid1/2344fdbd0db2bb7c96f3065cbed87f1b to your computer and use it in GitHub Desktop.
Save charlesreid1/2344fdbd0db2bb7c96f3065cbed87f1b to your computer and use it in GitHub Desktop.
PassByRef
public class PassByRef {
public static void main(String[] args) {
int[] array = new int[3];
array[0] = 100;
modifyArray(array);
System.out.println( Arrays.toString(array) );
}
public static void modifyArray(int[] array) {
array[0] = 5;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment