Java5.0之前的参数数量都是固定的。现在的版本提供了可变的参数数量的调用方法(有时称为“变参”方法)
程序:

public class VariableMethod {
    public static void main(String[] args) {
        variableMethod("a","b","c","d","e","f");
    }
    public static void variableMethod(String...s) {
        for(String e:s) {
            System.out.println(e);
        }
    }

运行结果:

a
b
c
d
e
f

现在来看今天的主要代码:

public static void variableMethod(String...s) {
        for(String e:s) {
            System.out.println(e);
        }
}

variableMethod()方法是一个无返有参的方法

String类型的数组,名字叫s...的意思为可以是无限数量个参数,参数必须为String类型