changing the elements of an array using a for loop java
int[] anIntArray = new int[6];
/*
This is for when you want to increment the contents of an array
using a for loop.
*/
for (int i = 0; i < anIntArray.length; i++) {
anIntArray[i]++;
}
//=============================================================================
String[] aStringArray = new String[6];
/*
This is for when you want to change the contents of an array
using a for loop
*/
for (int i = 0; i < aStringArray.length; i++) {
aStringArray[i] = 'The value it should change to'; //Should be compatible with the array type
}
Are there any code examples left?
New code examples in category TypeScript