- public class A{
- public static void main(String[] args){
- int a = add(1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
- int b = add(1,2,3,4,5);
- System.out.println(a+" "+b);
- }
- public static int add(int...v){
- int sum = 0;
- for(int x : v){
- sum =sum+ x;
- }
- return sum;
- }
- }
复制代码 |