与String有关的强制转换

String --> int

int i = Integer.parseInteger("123");

String --> double

double d = Double.parseDouble("1.0");
String --> float

float f = Float.parseFloat("1.0f");

int --> String

String s = Integer.toString(i);

double --> String

String s =Double.toString(d);

float --> String

String s = Float.toString(d);

原文地址:https://www.cnblogs.com/feifeishi/p/5305063.html