package trace01;
class varst{
static int us=1;
public static int mul(int... array){
for(int arrays:array)
us*=arrays;
return us;
}
}
public class varagsDemo {
public static void main(String[] args){
int imul=1;
imul=varst.mul(1,2,3,4,5);
System.out.println("1*2*3*4*5="+imul);
imul=varst.mul(1,2,3,4,5,6,7,8,9,10,11,12);
System.out.println("1至12之积为 "+ imul);
}
class varst{
static int us=1;
public static int mul(int... array){
for(int arrays:array)
us*=arrays;
return us;
}
}
public class varagsDemo {
public static void main(String[] args){
int imul=1;
imul=varst.mul(1,2,3,4,5);
System.out.println("1*2*3*4*5="+imul);
imul=varst.mul(1,2,3,4,5,6,7,8,9,10,11,12);
System.out.println("1至12之积为 "+ imul);
}
}
1*2*3*4*5=120
1至12之积为 1645617152
1*2*3*4*5=120
1至13之积为 -81813504
没想到13就超了