You can use
Character.toString(char)
.
Note that this method simply returns a call to
String.valueOf(char)
, which also works.
As others have noted, string concatenation works as a shortcut as well:
String s = "" + 's';
http://stackoverflow.com/questions/8172420/how-to-convert-a-char-to-a-string-in-java
No comments:
Post a Comment