String s = String.ValueOf(x); //converts a int x to a String s
int x = 3; Integer.toString(int)
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); } }
int c = 1234; String str3 = String.valueOf(c);
int d = 1234; Integer obj = new Integer(d); String str4 = obj.toString();
int i = 1234; String s = String.ValueOf(i)
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
int i=10; String s=String.valueOf(i);
Integer.toString(n) // converts n to String
StringBuilder sb = new StringBuilder(); sb.append(""); sb.append(number); return sb.toString();