Convert an ASCII character to a string in java

American Standard Code for Information Interchange abbreviated as ASCII is a code that represents letters, numbers, and symbols from 0 to 255. It includes numbers from 0-9, letters a-z, and uppercase letters a-Z. ASCII is represented by an integer value, if you want to convert this numeric value to a readable format (letter, number, or punctuation).

Java provides the method java.lang.Character.toString() to convert an ASCII character to a string.

public static String toString(char c): Returns a String object representing the specified char. The result is a String of length 1.

This example shows how to convert an ASCII character to a string in java.

public class ASCIIToString {

public static void main(String[] args) {
char ascii = 65;
String StringA = Character.toString(ascii);

ascii = 64;
String StringArobase = Character.toString(ascii);

System.out.println(StringA);
System.out.println(StringArobase);

/*display the entire alphabet a-z */
for(int i = 97; i <= 122; i++){
ascii = (char) i;
String letter = Character.toString(ascii);
System.out.print(letter+" ");
}
}

public String convert_ascii_to_string(char ascii) {
String letter = Character.toString(ascii);
return letter;
}
}
References:
Java.lang.Character.toString() Method