fill array string java code example
Example: fill array java
// fill array with counter (for loop) (1,2,3,4,5)
int[] myArray = new int[5];
for (int i = 0; i < myArray.length; i++) {
myArray[i] = i + 1;
}
// fill array with counter (for loop) (1,2,3,4,5)
int[] myArray = new int[5];
for (int i = 0; i < myArray.length; i++) {
myArray[i] = i + 1;
}