Converting char to string in Java
In java we can use the String.valueOf() method to convert a char to string.
Here is an example that converts char p to a string.
public class Main
{
public static void main(String[] args) {
char ok='p';
String str = String.valueOf(ok);
System.out.println(str);
}
}Output:
pSimilarly, you can use the string concatenation.
public class Main
{
public static void main(String[] args) {
char ok='p';
String str = ""+ok;
System.out.println(str);
}
}

