Convert an int value to String: new Integer(i).toString() : Convert to String « Data Type « Java
- Java
- Data Type
- Convert to String
Convert an int value to String: new Integer(i).toString()
public class Main {
public static void main(String[] args) {
int i = 50;
String str = new Integer(i).toString();
System.out.println(str + " : " + new Integer(i).toString().getClass());
}
}
//50 : class java.lang.String
Related examples in the same category