Hello,
I would like to know how to add elements to an array of a specified size without specifying their indices. For example,
int[] newArr = new int[5];
newArr[] = 4;
newArr[] = 6;
This means I want newArr to look like this:
[4][6][ ][ ][ ]
This does not work, even though it does in other languages such as PHP. Can anyone tell me how to do this in Java? I would appreciate it!