意思就是:参数的个数可以根据需要写,你可以写1个、2个、3个、、、、他们都被保存到一个参数的数组中。
But these participants have some constraints: they must be the same type, such as the String string type.
At the same time, the writing of the parameters in the variable parameter function is also constrained: for example, the array of variable parameters must be written at the end of the parameter, otherwise the program does not know how many parameters are.
Example: The parameter value in the output variable parameter
Public Class VarialGument {Public Static Void Main (String [] ARGS) {PrintarGumentsinfo ("AAA", "BBB", "CCC", "DDD", "Ely");} /*** print parameters* @para M Strings parameter A array*/ Public Static Void PrintargumentsInfo (String ... String ... for (Int I = 0; I <strings.length; I ++) {System.out.println ("Parameter"+(I+1)+" : "+Strings [i]);}}} result:
Parameter 1: AAA Parameter 2: BBB Parameter 3: CCC Parameter 4: DDD Parameter 5: EEE
The above is all the contents of this article. I hope everyone can like it.