Convert int to String in Java

With the help of String.valueOf() and Integer.toString() methods, you can convert int to String in Java.

Example of Java int to String conversion

Following is the example that will show conversion from int to String-

public class Example
{
	public static void main(String args[])
	{
		int i = 10;
		String a = String.valueOf(i);		
		String b = Integer.toString(i);
		System.out.println("a = "+a);
		System.out.println("b = "+b);
	}
}

Output

a = 10
b = 10