Question: What will be the order of the array elements at the end of the program? int[] array = {14, 8, 16, 11, 13}; for (int
What will be the order of the array elements at the end of the program?
int[] array = {14, 8, 16, 11, 13};
for (int i = 0; i < array.length - 1; i++) {
if (array[i]< array[i + 1]) {
int temp = array[i];
array[i] = array[i + 1];
array[i + 1] = temp;
}
}
| 14 16 11 13 8 | ||
| ThrowsArrayIndexOutOfBoundsException | ||
| 14 8 16 11 13 | ||
| 8 11 13 14 16 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
