Java – Convert Integer to String

In Java, you can use String.valueOf() to convert an Integer to String.

1. String.valueOf

1.1 Example to convert an Integer or int 10 to a String.


	Integer num = 10;
	//int num = 10;
	
	String numInString = String.valueOf(num);

	System.out.println(numInString);

Output


10

2. toString()

It works on Integer object only.


	Integer num = 10;

	String numInString = num.toString();

	System.out.println(numInString);

Output


10

2.2 For primitive type int, try Integer.toString()


	int num = 10;

	String numInString = Integer.toString(num);

	System.out.println(numInString);

Output


10

References

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar