Solution:
Hello Gavin,
As I can understand you wanted to write a program where you can convert a number (65) into a letter (A) but you gave the title of your problem is, “Convert int to the string”
No worries. I am trying to make it easy for both cases as following below:
public class IntToString
{
public static void main(String args[])
{
int a = 65;
String s = Integer.toString(a);
System.out.println("String s = " + s);
}
}
On the above code, I used the function Integer.toString() it helps to cast an integer number into a string type.
public class IntToChar
{
public static void main(String args[])
{
int a1 = 65;
char ch = (char) a1;
System.out.println("Integer value: " + a1);
System.out.println("Char value: " + ch);
}
}
I really hope it might help you.