可以使用String类的valueOf()方法将int类型转换为String类型:

int num = 123;
String str = String.valueOf(num);

或者使用Integer类的toString()方法:

int num = 123;
String str = Integer.toString(num);

还可以使用String类的format()方法:

int num = 123;
String str = String.format("%d", num);
java中int转String

原文地址: https://www.cveoy.top/t/topic/hixj 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录