EN
Java - convert char to string
0 points
In this article, we would like to show you how to convert char to string in Java.
Quick solution:
xxxxxxxxxx
1
char character = 'x';
2
String result = String.valueOf(character);
In this example, we present the second solution of how to convert char to String - using Character toString()
method.
xxxxxxxxxx
1
public class Example {
2
3
public static void main(String[] args) {
4
char character = 'x';
5
String result = Character.toString(character);
6
}
7
}