You are viewing a single comment's thread. Return to all comments →
"int" is a primitive data type.
"String" is a class.
So,to convert integer to a string,it should be a object.
Convert "int" to "Integer" as follows.
int n = sc.nextInt();
Integer i = new Integer(n);
Now "Integer" and "String" are classes.We can convert Integer to String using "toString()".
String s = i.toString();