1String s = String.ValueOf(x); //converts a int x to a String s
2
3//or
4
5String s = Integer(x).toString(); //converts a int x to a String s
1class GfG
2{
3 public static void main(String args[])
4 {
5 int a = 1234;
6 int b = -1234;
7 String str1 = Integer.toString(a);
8 String str2 = Integer.toString(b);
9 System.out.println("String str1 = " + str1);
10 System.out.println("String str2 = " + str2);
11 }
12}
13