Convert an int value to String by concatenating string to an int value in Java
Description
The following code shows how to convert an int value to String by concatenating string to an int value.
Example
/*from w ww . ja va2 s .c om*/
public class Main {
public static void main(String[] args) {
int i = 50;
String str = "" + i;
System.out.println(str + " : " + ("" + i).getClass());
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »