好多方法哦!!
方法1
String counter=null ;
counter=Integer.toString( Integer.parseInt( counter )+1 ) ;
方法2
String temp=(new Integer(counter)).intValue()+1;
方法3
int a=(int)(Math.random()*100);
String num=new String(); // 不能写 String num; 也不知道是为什么
num=num.valueOf(a);
方法4
int MyInt = 1234; //整数转换成字符串,其它数据类型可以利用同样的方法转换成字符串。
String MyString = "" + MyInt;
方法1
String counter=null ;
counter=Integer.toString( Integer.parseInt( counter )+1 ) ;
方法2
String temp=(new Integer(counter)).intValue()+1;
方法3
int a=(int)(Math.random()*100);
String num=new String(); // 不能写 String num; 也不知道是为什么
num=num.valueOf(a);
方法4
int MyInt = 1234; //整数转换成字符串,其它数据类型可以利用同样的方法转换成字符串。
String MyString = "" + MyInt;
int nYourInt = 128; //suppose!
Sting strTemp;
strTemp.valueOf(nYourInt ) ; // strTemp is your result!
or:
int nYourInt = 128; //suppose!
Sting strTemp = String.valueOf(nYourInt ) ; because
String.valueOf(nYourInt ) ;
is a static method.
这n简单,想复杂也复杂不起来的说
public class Test {
public static void main (String[] args) {
int i = 125435;
String str = Integer.toString(i);
System.out.println(str);
}
}