String.valueOf(int i)和Integer.toString(int i)有什么区别?
publicclassDemo1{publicstaticvoidmain(String[]args){fun2();}privatestaticvoidfun2(){i...
public class Demo1 {
public static void main(String[] args) {
fun2();
}
private static void fun2() {
int x = 123;
String s = String.valueOf(x);
String s1 = Integer.toString(x);
System.out.println(x + 1);
System.out.println(s + 1);
System.out.println(s1 + 1);
}
}
String.valueOf(int i)和Integer.toString(int i)有什么区别? 展开
public static void main(String[] args) {
fun2();
}
private static void fun2() {
int x = 123;
String s = String.valueOf(x);
String s1 = Integer.toString(x);
System.out.println(x + 1);
System.out.println(s + 1);
System.out.println(s1 + 1);
}
}
String.valueOf(int i)和Integer.toString(int i)有什么区别? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询