【发布时间】:2020-05-11 10:10:32
【问题描述】:
我有以下代码:
class Example{
public static void main(String args[]){
System.out.println('1'+'1');
}
}
为什么会输出98?
【问题讨论】:
-
相关:In Java, is the result of the addition of two chars an int or a char? 我怀疑这个问题是重复的。我还没有找到确切的原件。
-
您期望得到哪个输出(如果您有任何期望)? 2? 11?编译时错误?
-
另见Concatenate chars to form String in java,它告诉您如何从 char 构建字符串。
标签: java system.out custom-data-type