mik_blom
-20
Q:

int to string java

String s = String.ValueOf(x); //converts a int x to a String s
5
int x = 3;

Integer.toString(int) 
26
class GfG 
{ 
  public static void main(String args[]) 
  { 
    int a = 1234; 
    int b = -1234; 
    String str1 = Integer.toString(a); 
    String str2 = Integer.toString(b); 
    System.out.println("String str1 = " + str1);  
    System.out.println("String str2 = " + str2); 
  } 
}  
13
int c = 1234; 
String str3 = String.valueOf(c); 
9
int d = 1234; 
Integer obj = new Integer(d); 
String str4 = obj.toString();
11
int i = 1234; 
String s = String.ValueOf(i)
1
String s = String.ValueOf(x); //converts a int x to a String s

//or

String s = Integer(x).toString();	//converts a int x to a String s
2
int i=10;  
String s=String.valueOf(i);
1
Integer.toString(n) // converts n to String
1
StringBuilder sb = new StringBuilder();
sb.append("");
sb.append(number);
return sb.toString();
2

New to Communities?

Join the community