📜  char 无法转换为字符串 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:19.156000             🧑  作者: Mango

代码示例1
//As the compiler said, you can't convert a char to a String. 
//If you have a char and you really want to convert it to a String of length 1, 
//this will work:

String s = String.valueOf(c);
//Or
String s = Character.toString(c);