Подскажите по выводу массива в обратном порядке.
Я вывел вот так
equal to the size of the array.
Индекс был равен размеру массива, но вот так и не понял как этого избежать и не использовать костыль.
Заранее спасибо.
for (int i = 9; i > 0; i--){
System.out.println(massive10[i]);
}
System.out.println(massive10[0]);
Так как следующий код дал мне Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10
for (int i = 10; i > 0; i--){
System.out.println(massive10[i]);
}
Я прочитал что это из-за:
https://docs.oracle.com/javase/7/docs/api/java/lang/ArrayIndexOutOfBoundsException.html
Thrown to indicate that an array has been accessed with an illegal index. The index is either negative or greater than or