总结:int ----->String

package com.a.b;

//测试。。char--->int
// int--->String 
public class Yue2 {
	public static void main(String[] args) {
		int i = 322;
		String s = "" + i;// 将整型转换为字符串
		System.out.println(s);
	}
}

  2.String ---->int

public class Yue2 {
	public static void main(String[] args) {
		// 将String---->int 型

		String s = "23232";// 这里有限制,也就是字符串里的内容必须是整型数字,float类型也不可以
		int x = Integer.parseInt(s);
		System.out.println(x);
	}
}

  

 

相关文章:

  • 2021-08-18
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
猜你喜欢
  • 2021-11-04
  • 2022-01-22
  • 2022-12-23
相关资源
相似解决方案