java基本数据类型转换字符串

1、基本数据类型转换为字符串

int t1 = 2;
String t2 = Integer.toString(t1);

2、字符串转换为基本数据类型

int t3 = Integer.parseInt(t2);
double t4 = Double.parseDouble(t2);
....
int t5 = Integer.valueOf(t2)

猜你喜欢

转载自blog.csdn.net/qq_38723677/article/details/85267609