把你的String型数组遍历一次,然后通过Double.parseDouble把String型数组每个值转换一次。然后赋值给Double型数组中值
String[] str = new String[] { "1.0", "2.0", "3.0" };
double[] dou = new double[3];
for (int i = 0, len = str.length; i < len; i++) {
dou[i] = Double.valueOf(str[i]);
}
public static void main(String[] args) {
String[] strs={"111.1","222.2","33.33"};
Double[] ds=new Double[strs.length];
for(int i=0;i
}
//打印double型数组
for(double d:ds){
System.out.println(d);
}
}
强转就可以了。
String str = "12.3";
double dot = (double)str;
LZ你听过这么转的吗?我好像没听过