exec(Object ... obj) java函数参数不定个数

 

public class test {
	public static void main(String[] args) {
		new test().exec("1","2","3");
	}
	
	public void exec(String...xxx){
		System.out.println(xxx.length);
	}
}

 

String...xxx的4种写法

1. String...xxx

2. String ...xxx

3. String... xxx(使用Eclipse规范代码后是这种)

4. String ... xxx

你可能感兴趣的:(java,eclipse)