Convert int to String in Java

Sometimes, we may need to Convert int to String in Java. An int can be converted to String in java in following ways.

1) Using String.valueOf(int i):

The String.valueOf() method takes integer value as an input and returns the String representation of the int argument.


i – an int.

a string representation of the int argument.

2) Using Integer.toString(int i):

This method is same as String.valueOf(int i) method and returns a String object representing this Integer’s value.


i – an integer to be converted.

Returns a String object representing the specified integer. The argument is converted to signed decimal representation and returned as a string.


Let’s see how to Convert int to String with an example. Here we have taken 2 integer variables which are to be converted to String.

Let’s see the output of the above program.


The above program demonstrates the int to String conversion with an example. If you want to convert String to int in Java, then read tutorial on Convert String to int in Java.