0

Array

how to fill an array and print in reverse order

18th Jun 2021, 1:40 PM
Best of Sport
Best of Sport - avatar
1 Resposta
+ 1
You can use: public class Program { public static void main(String[] args) { int[] a = { 2, 3, 4 }; int length = 0; for (int element : a) { length++; } for (int i = length - 1; i >= 0; i--) { System.out.println(a[i]); } } }
18th Jun 2021, 1:46 PM
SammE
SammE - avatar