经典作品--Java解惑谜题连载⑤ 下列程序的输出结果,为什么System.out.println(Long.toHexString(0x100000000+0xcafebabe)); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Exception in thread "main" java.lang.Error: Unresolved compilation problem: The literal 0x100000000 of type int is out of range test.java:3: 过大的整数: 100000000 System.out.println(Long.toHexString(0x100000000+0xcafebabe)); ^1 错误 报错,原因:0x100000000 未加任何后缀,其为 int 类型,如果是 int 的话,0x 后面最多只能有八位,因为 int 类型采用 8 个字节来表示的,要让其正确只要改成:System.out.println(Long.toHexString(0x100000000L+0xcafebabeL));加个“L”采用 long 型数据来表示就可以了。 破圈法的证明 看不懂 求讲解 谢谢 考试题 Mysql无法使用中文的搜索条件 Timer类程序不明白 向各位高手请教java连结sql2005的连结字符串(不要jdbcodbc桥) 有没有一个函数可以直接得到ButtonGroup选中按钮的标题?????? JAVA象C++中运算符重载怎么做? web服务如何向指定页面推送数据 如何将long型转换成String型?在线等! 一个很孤独,依赖性很强却又很喜欢JAVA的人会学好JAVA吗? 在JDBTable中如何选中行? JNLP从网页打开后,运行进程无法关闭问题 swing初学者,大家帮帮我的忙~~~
The literal 0x100000000 of type int is out of range
System.out.println(Long.toHexString(0x100000000+0xcafebabe));
^
1 错误