对于中文单个 字使用char还是String
public class HelloWorld{
public static void main(String[] args) {
final char="男";
final char="女";
System.out.println(a);
System.out.println(b);
}
}
观察到结果如下
HelloWorld.java:3: error: incompatible types: String cannot be converted to char final char a="男"; ^ HelloWorld.java:4: error: incompatible types: String cannot be converted to char final char b="女"; ^ 2 errors
为什么呢?