Java Convert into string

Basically there are two ways of converting int to string in Java. Both are listed below.

1. Java int to String using Integer.toString()

public static String toString(int i) Returns a String object representing the specified integer. The argument is converted to signed decimal representation and returned as a string, exactly as if the argument and radix 10 were given as arguments to the toString(int, int) method.

2. Java int to String using String.valueOf()

public static String valueOf(int i) Returns the string representation of the int argument. The representation is exactly the one returned by the Integer.toString method of one argument.


Partner Sites