【发布时间】:2013-08-14 04:40:25
【问题描述】:
为什么 java 常量有奇怪的行为(Unicode 字符和正常表示).. 我的意思是看下面的例子。 注意:所有代码都是java语言。
char a = '\u0061'; //This is correct
char 'a' = 'a'; //This gives compile time error
char \u0061 = 'a'; //this is correct no error
ch\u0061r a = 'a'; //This too works
ch'a'r a = 'a'; // This really is confusing compile time error
为什么最后一个声明不起作用而 ch\u0061r a='a'; 起作用?
【问题讨论】:
-
@Subhrajyoti Majumder 感谢您的编辑..
标签: java unicode character declaration