Skip to content

Instantly share code, notes, and snippets.

@jweinst1
Created August 31, 2015 22:53
Show Gist options
  • Select an option

  • Save jweinst1/7bd4e2b48463b38d95ae to your computer and use it in GitHub Desktop.

Select an option

Save jweinst1/7bd4e2b48463b38d95ae to your computer and use it in GitHub Desktop.
Set an Array to a different value in Java
import java.util.Arrays;
class Main {
public static void main(String[] args) {
System.out.println(Arrays.toString(setvalue(thing, 2, 50)));
}
static int[] thing = {1, 2, 3};
static int[] setvalue(int[] x, int y, int z) {
x[y] = z;
return x;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment