 Hello friends, I am Sanjay Gupta. I welcome you on my channel. You can watch various programming related videos on my channel. So you can search it. You can subscribe it for various updates. It contains more than 800 videos. You can search those videos through the keyword programming by Sanjay Gupta on YouTube. In this video, I am going to demonstrate you how you can use variable length argument list in Java. Variable length argument list means you have to define a method and that method can receive different quantities of arguments through its call. So let's do it how you can implement this concept in Java. So name of classes, where length, arcs. In this class, I will be defining two methods. One will be defining how you can receive variable length arguments and another method will be calling that method. So this is first method whose name is sum. Its return type is double. It is of static type. It will receive double arguments, but quantities of argument is not specified. So I have used these three dots. Watch these three dots carefully with data type. So double then three dots. It is a notation which is used in Java so that a particular argument can be converted into array. So this ARR is not a variable here. It is an array which can receive different quantities of arguments which will be passed through the calling of this sum method. After defining this method, another method will be main. So inside main method, I will be calling this sum method. So let's write calling first then I will be finding it. So I'm going to declare three variables of double type. Inside system.out.println, I will be calling sum method and I will be passing arguments in it. So you can see at line number 11, I have called sum method and I'm passing two arguments. At line number 12, I am calling again sum method and this time I am passing three arguments. And for these two different calls, I'm going to define a single definition. So here I am declaring a variable as which will be containing sum. Then I am going to implement a loop. This loop will repeat ARR dot length time. So see this condition carefully. We don't know how many arguments will be received through this ARR variable. But these three dots have converted this ARR variable into array. And in Java, there is a special attribute that is known as length available in array. So if you don't know the size, you can use ARR dot length to identify the size of array. So that's why I have used it here. So this statement will be calculating sum. After completion of this loop, I can return sum. So this way I have implemented the complete core in front of you. First method, which is sum, is calculating sum and it will be receiving different arguments. And in main method, I have called sum method twice. First, it is passing two arguments. Second, it is passing three arguments. So this is not possible with C and C++ because there is no such kind of feature available. You have to pass a required number of arguments at each function call. But in case of Java, you can pass different quantities. Now I'm going to execute this code. I forward to save this code. It is in the output of previous code. Now see this. I have passed two arguments A1, A2. So first argument is A1 whose value is 2.5. Second argument is A2 whose value is 5.5. So if we add these two numbers, sum will be 8.0, which is correct. If I add 3.5 also, like at line number 17, I have passed A1, A2, A3, 3 arguments. So 2.5 plus 5.5 plus 3.5 makes 11.5. So this way you can see the program is working properly. I hope you have understood how we can use a variable length argument list in Java. So using this feature, you can pass different quantities of argument to a particular method. I hope you have understood whatever I have demonstrated in this video. If you want to watch more programming related videos, you can search the keyword Programming by Sanjay Gupta on YouTube. Thank you for watching this video.