1.
Q1: Put the code in the appropriate order so that an array of integers will store multiples of 5 (0 to 100) in reverse order.
arrayName[index]
returns value stored at that index
(arrayName.length-1)
, inclusive otherwise an IndexOutOfBounds exception occurs at runtime
public void addOne(int[] numbers) {
for (int index = 0; index < numbers.length; index++ ) {
numbers[index] = numbers + 1;
}
}
public void addOne(int[] numbers) {
for (int num: numbers) {
num++;
}
}
public void addOne(int[] numbers) {
for (int num: numbers) {
numbers[num] = numbers[num] + 1;
}
}
public void addOne(int[] numbers) {
for (int index = 0; index $lt; numbers.length; index++) {
numbers[index] = index + 1;
}
}