Many java api methods have the application of variable parameters. variable parameters, that is, the number of method parameters is not specified. You can enter a valid number of parameters at will. Variable parameters can be used to flexibly input parameters during method calling, similar to method overloading. Method overload: public void dosomething (int ){......} public void dosomething (int a, int B ){......} public void dosomething (int a, int B, int c ){......} if the method body processes the input parameters in the same way, such as summation and product calculation, you can consider the use of variable parameters: public void dosomething (int... nums ){......} example of variable parameters for summation: [java] public class ChangeParameterTest {public static void main (String [] args) {// call method of variable parameter methods 1 sum (1, 2, 3, 4, 5); // call method of variable parameter method 2 int arr [] = {1, 3, 5, 7}; sum (arr) ;}// sum publ with variable parameters Ic static void sum (int... nums) {// nums is an array int sum = 0; for (int I: nums) {sum + = I;} www.2cto.com System. out. println (sum) ;}}when using variable parameters: 1. variable parameters can only be placed at the end of the parameter list. Public void sum (int... nums, int y) unqualified public void sum (int y, int... nums) pass 2. In the method body, variable parameters can be accessed as arrays. Public void sum (int... nums) has int arr [] = nums;