You can use String.valueOf() or Integer.toString() method to convert an int value to String object in Java. Remember, String is not just a char array but a full feature object in Java. The standard way to convert one object to String in Java is just calling the toString() method, but since here we need to convert primitive int to String, I prefer to use String.valueOf(int) method. It reads better because we are converting an int to String and not an Integer to String. There is a difference between them, int is a primitive value while Integer is a wrapper object in Java. BTW, there is one more way to convert an int value to String in Java, the easiest one, String concatenation. Even though Java doesn't support operator overloading, + operator behaves differently with integer and String operands. If one of the argument to this binary operator is String then it performs String concatenation, otherwise, it does addition. So you can convert an int value e.g. 10 to a String value "10" by just doing "" + 10.
Read more »
