convert character to char java code example
Example 1: convert char to string java
char c = 'a';
String s = Character.toString(c);
//s == "a"
Example 2: Converting Char to String in java
class CharToStringDemo
{
public static void main(String args[])
{
// Method 1: Using toString() method
char ch = 'a';
String str = Character.toString(ch);
System.out.println("String is: "+str);
// Method 2: Using valueOf() method
String str2 = String.valueOf(ch);
System.out.println("String is: "+str2);
}
}