- 将字符串转换成double类型的数字:
String s = "2345";
double a = Double.parseDouble(s);
- 将字符串转换成Float类型的数字:
String s = "124";
float a = Float.parseFloat(s);
- 将字符串转换成整形的数字:
String s = "2345";
double a = Integer.parseInt(s);
String s = "2345";
double a = Double.parseDouble(s);
String s = "124";
float a = Float.parseFloat(s);
String s = "2345";
double a = Integer.parseInt(s);