Here, we are creating an ArrayList, adding 5 elements (100, 200, 300, 400 and 500) and printing them in reverse order.
To print elements in reverse order, we are running a loop from N-1 (Here, N is the total number of elements in the ArrayList) to 0.
To get the total number of elements of ArrayList, we use arrList.size() method of “ArrayList” class, here arrList is an object of ArrayList class.
Consider the program
Output