package com.dong;
interface dong{public Double sum();}
class Demo implements dong{
T[] t ;
public Demo(T[] t) {
this.t=t;
}
@Override
public Double sum() {
// TODO Auto-generated method stub
Double sum=new Double(0.0);
for(T s:t) {
sum+=s.doublevalue();
}
return sum;
}
public static void main(String[] args) {
Integer[] a1 = new Integer[] {1,2,3,45,6,7};
Double[] a2=new Double[]{1.0,2.0,3.0,45.0,6.0,7.0};
// 适配器包装数组
Demo a11 = new Demo(a1);
Demoa22=new Demo(a2);
System.out.println(a11.sum());
System.out.println(a22.sum());
}
}