 Hello friends, I am Sanjay Gupta. In this video I am going to demonstrate you how you can print elements of array in reverse order in Java. If you won't follow me, you can subscribe my youtube channel. Now coming on to the code, first of all I am going to import util package and inside util package there is a class whose name is scanner. This scanner class is used to read values from user. Now I am going to define another class whose name is reverse. Inside this reverse class I am going to define main method. Inside this main method I am going to implement the code which will print the numbers which are available in array in reverse order. So first of all I am going to declare an array. Name of array is ARR. Variable n will be receiving size of array and then variable i for iteration of loops. Now I am creating instance of scanner class which will read values from user and here I am passing system.in as constructor value. It means all the input will be received from console. With the help of this statement the message enter size of array will be displayed on output screen. To receive input I am calling next id method which is available in scanner class. So the received input will be stored inside add variable. So n is denoting the size of array. Now I can create blocks for this array with the help of n. So now at line number 11 I have created memory blocks for the array. After creating memory blocks I can print the message enter elements on output screen to read values from user. I am writing this loop. This loop is starting from 0 it will repeat till this condition is true that is i doesn't ARR not length. So length of the attribute of array it provides size of the array automatically. Now inside this loop I am going to write the statement ARR of i equals to input dot next int. So next int method will be receiving values from user and those values will be stored inside the array at ith index. So this loop will repeat till ARR dot length times. After receiving all the successful inputs all the values will be stored at different indexes of this ARR array. Now I have to print the stored elements in reverse order. First this message will be displayed on output screen that is array in reverse order. Now again I have to implement the loop sorry to print array in reverse order I have to start loop with this condition sorry this initialization condition will be this and in place of increment I am using decrement. So let's understand this loop. I have initialized i with ARR dot length minus 1. So ARR dot length provides total size of array and indexes of array starts from 0. So last location will be length minus 1. So I will be containing last index. So for example length is 10. So this i will be containing 9 because 10th location index is 9. Now the condition is i greater than equals to 0. From 9 this loop will be decremented till 0. So that's why this condition and for decrement by 1 I have used i minus minus. Now to print values I am using system dot out dot print element then ARR i. So this way I have implemented the complete code in front of you. Here first loop is reading the values from user and second loop will be printing those entered values in reverse order. After implementation you can see I have saved this code in d drive and java folder with name array reverse. So after implementation you have to save this code. Now I am going to open command prompt. Here first you can see I am moving to d drive and java folder because code is available at this location. After printing to particular first you need to compile your code. So you can see I have written javasi command for compilation purpose. If your code is containing any kind of error those errors will be displayed otherwise successful compilation will be done and byte code will be generated. After compilation you can run your code with java command. So here you can see it is asking for the size. So I am entering 5. Now you can see it is asking for the elements. So I have entered 5 elements. After providing proper input it will show array in reverse order. As you can see here I have entered 1 2 3 4 5 and it is printing output in reverse order that is 5 4 3 2 1. So it is successfully printing array in reverse order. So I hope you have understood how we can print elements of array in reverse order in java. If you want to follow me you can subscribe my youtube channel. Thank you for watching this video.