class Demo { public static int sum(int ... data) { //此处可以传递一个数组,也可以是多个参数 int sum = 0; for (int i : data) sum = sum + i; return sum; } } public class Variable { public static void main(String[] args) { System.out.println(Demo.sum(1,2,3,4,5)); System.o…