//正确声明方式
public static void dealArray(int... intArray){
}
}
public static void dealArray(int... intArray, int count){ //编译报错,可变参数类型应该作为参数列表的最后一项
}
}
//声明0到多个int类型的参数
package com.mw.mbox.boss.util;
public class Test {
public void run(int...is){
if(is!=null && is.length>0){
for (int i = 0; i < is.length; i++) {
System.out.println("@@@@@");
}
}
}
public static void main(String[] args) {
Test test = new Test();
test.run(123,234);
}
}
public class Test {
public void run(int...is){
if(is!=null && is.length>0){
for (int i = 0; i < is.length; i++) {
System.out.println("@@@@@");
}
}
}
public static void main(String[] args) {
Test test = new Test();
test.run(123,234);
}
}