Created
August 31, 2015 22:53
-
-
Save jweinst1/7bd4e2b48463b38d95ae to your computer and use it in GitHub Desktop.
Set an Array to a different value in Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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