Variable parameters: its essence is an array, the elements will automatically packaged into an array.
format:
Method name (parameter type name ...)
{
... code ...
}
Note: The variable parameters must be the end of the parameter list again
Usage is as follows:
1 public int add(int... p_intParams){ 2 int sum = 0; 3 for(int i=0;i<p_intParams.length;i++){ 4 sum+=p_intParams[i]; 5 } 6 return sum; 7 }