 Hello friends, I am Sanjay Gupta. I welcome you on my channel. You can watch various programming related videos on my channel. So search it, subscribe it. You can find more than 800 videos related to programming on my channel. In this video, I am going to demonstrate you how you can receive and number of command line arguments in Java and how you can calculate their sum. So you might have faced problems like one time you have to pass two arguments and you have to produce their sum. In another time you have to pass five numbers and you have to calculate their sum using command line arguments. So we can implement only one program to perform addition of n numbers. So name of classes cmd then I am implementing main function inside main function. I will be implementing the code which will calculate some here ARGS array is available, which will receive the command line arguments. So we have to use this ARGS array, which is of string type for calculating some. So I'm declaring some variables. Now I am implementing a loop which will repeat ARGS dot length times in Java. Each array has spatial attribute whose name is length, which provides size of the array. So we don't know how many arguments will be passed at runtime. So for identification purpose, I have used ARGS dot length. It will provide size that how many arguments are available and that length will be deciding number of rotation of this loop. Now I am implementing the addition logic. So before addition, I need to convert all the arguments which are available in form of string into integer. So for that purpose, I am using integer class and a method passing and I am passing ARGS of I inside it. So ARGS dot sorry, integer dot parsing will be converting ARGS of I value into integer and that integer value will be added into s variable each time. So suppose you are passing two arguments only loop will repeat two times. In a particular case, you are passing five arguments. This loop will repeat five times after completion of loop. I can rent value of s on output screen as some. So this way I have implemented the complete code, which will receive n number of arguments every time whenever it is executing and then printing their sum. So you can see I have compiled the code and I have passed four arguments first time and it is printing their sum. So arguments are one, two, three, four and their sum is 10. So it is working properly. Again, I am going to execute this code and I am passing six arguments one, two, three, four, five, six. You can see the output. It is printing 21. So addition of one, two, three, four, five and six is 21. So the program is working properly. It is producing correct results on output screen. I hope you have understood how we can receive n number of arguments every time whenever we execute the Java program through command line arguments. If you want to watch more programming related videos, you can follow my YouTube channel. You can subscribe it. It contains 800 videos, more than 800 videos. Thank you for watching this video.