how to assign values to elements in an array java
To assign values to the various positions in an array, you do it in the normal way: aryNums[0] = 10; Here, a value of 10 is being assigned to position 0 in the array called aryNums. Again, the square brackets are used to refer to each position.