unicode编码问题 我知道'\u000a'和'\u000d'是表示回车字符,不明白在eclipse中,char c='\u000a'为何提示字符常量无效。求解,谢谢各位! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 String s = "中国人"; try { byte[] unicodeb= s.getBytes("unicode"); String s_unidode = new String(unicodeb,"unicode"); System.out.print(s_unidode.getBytes("unicode"));} catch (UnsupportedEncodingException e) { e.printStackTrace();} \u000a \u000d 属于单行注释,在程序里无法调用你可以试一下// \u000d hellocompiler一样报错用'\n'替换就是了 char c = 0x000a;把html的字符和java的16进制混淆了吧。 补充一下你看到的char c='\u000a'在编译阶段实际已经被转换成char c='a'结果可想而知 各位,我还是没弄明白!可是,'\u000b','\u000c','\u000e','\u000f'都是合法的啊! java中的字符是可以用Unicode编码来表示的。但是unicode中有一些比较特殊的字符,比如换行,回车等是不能用unicode代码的,在java中有其特殊的写法,如:\u000a 换行,在java中用\n来表示;\u000d 回车,在java中用\r来表示;还有\",\\等等。也就是说在用到这些字符的unicode时要用其代替. JAVA初学者,请问以下程序中特定字符串何时被输出 编写 JAVA 界面 获取文件地址 【新手提问】请问怎么弹出对话窗口,可以选择确定和取消?按确定继续,按取消退出. 急!一个简单的错误 怎么样把java类加载到数据库中? 看看我这是为什么呀? 俺是新手,帮我看看这个问题。 "Exception in thread "main" java.lang.NoClassDefFoundError: helloworld "????? 这两句有什么错误啊? 紧急:请问谁知道如何在JAVA中去调用执行操作系统中的其他可执行文件啊? jTable的导入问题 问一下SWING中怎样布局的问题.
try {
byte[] unicodeb= s.getBytes("unicode");
String s_unidode = new String(unicodeb,"unicode");
System.out.print(s_unidode.getBytes("unicode"));
} catch (UnsupportedEncodingException e) { e.printStackTrace();
}
你可以试一下
// \u000d hello
compiler一样报错
用'\n'替换就是了
把html的字符和java的16进制混淆了吧。
你看到的char c='\u000a'
在编译阶段实际已经被转换成char c='
a'结果可想而知