如何实现String和int数据的相互转换

来源:互联网 发布:淘宝鲁班系统 编辑:程序博客网 时间:2024/04/20 02:02

String 转换到 int的方式:

1.       通过Integer类的构造方法

2.       通过Integer类的intValue()方法

3.       通过Integer类的parseInt()方法

4.       通过Integer类的valueOf()方法

Int 转换到 String的方式:

1.       通过String类的构造方法

2.       通过String类的valueOf()方法

3.       通过Integer类的toSting()方法

4.       通过与字符串""相连接

 

0 0