1.字符串类型向整形转换

int age = Integer.parseInt(strAge);

2

int -> String

int i=12;
String s="";
第一种方法:s=i+"";
第二种方法:s=String.valueOf(i);

3

String -> int

s="12";
int i;
第一种方法:i=Integer.parseInt(s);
第二种方法:i=Integer.valueOf(s).intValue();

相关文章:

  • 2021-05-22
  • 2021-09-13
猜你喜欢
  • 2022-01-05
  • 2021-11-19
  • 2021-10-09
  • 2022-01-29
  • 2021-08-08
相关资源
相似解决方案