IUSR's Ughten of Silent Requiem

To whom it may resurrect
zh en ja

避免在autoboxing过程中使用基本类型

2005-04-05 技术文章

以前就知道这个现象,不过没继续追究过。今儿打开Gmail ,有封Core Java Techologies Tech Tips,正好提到这事儿,摘录如下:

The primitives are equal and the values of the boxed ints are equal. But this time the ints point to different objects. What you have discovered is that for small integral values, the objects are cached in a pool much like Strings. When i and j are 2, a single object is referenced from two different locations. When i and j are 2000, two separate objects are referenced. Autoboxing is guaranteed to return the same object for integral values in the range [-128, 127], but an implementation may, at its discretion, cache values outside of that range. It would be bad style to rely on this caching in your code.相关链接:http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html

继续阅读

当Mozilla Firefox访问剪切板失败时

2005-03-18 技术文章

一个不怎么舒服的问题……Mozilla Firefox在遇到需要Rich Edit控件中粘贴RTF类型文本时,通常会跳出个让人不爽的对话框,大抵是说“为了您的安全拒绝了对剪切板的访问”等等,点“Yes”就会到一个链接,告诉您怎么解决。

继续阅读
较旧的帖子 较新的帖子