1、把int转化为String

以下三种方式把整形地i转化为字符串s,当然把Double、Float、Long转化为字符串操作一样。

1.String s=""+i;
2.String s=Integer.toString(i);
3.String s=String.valueOf(i);

2、把String转化为int型。

1.int i=Integer.parsenInt(s);
2.int i=Integer.valueOf(s).intValue();

3、把Integer转化为String

Integer integer=String()

4、把String转化为Integer

Integer integer=Integer.valueOf(i)

5、把int转化为Integer

Integer integer=new Integer()

6、把Integer转化为int

int num=Integer.intValue()

7、把String转化为BigDecimal

BigDecimal bd=new BigDecimal(str)

8、把整型数x转化为char

char a =(char)('a'+x)

————————————————
版权声明:本文为CSDN博主「eacxzm」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/eacxzm/article/details/80064752

相关文章:

  • 2021-05-19
  • 2021-09-29
  • 2021-10-28
  • 2021-11-19
  • 2021-11-03
  • 2022-12-23
  • 2021-08-02
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-23
  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
相关资源
相似解决方案