代码
package ch1_1;
public class Ex08 {
public static void main(String[] args) {
// it print out the char 'b'
System.out.println('b');
// the Unicode of 'b' is 98, of 'c' is 99, so 'b' + 'c' = 197
System.out.println('b' + 'c');
// the Unicode of 'a' is 97, the Unicode of 'e' is 101
System.out.println((char) ('a' + 4));
}
}
总结
a:输出字符'b'
b:操作符+使得此语句变成计算'b'和'c'的Unicode值之和,即98与99之和
c:'a'的Unicode值是97,而'e'的Unicode值为101,所以输出字符'e'