| 1. | You create the stringbuffer object just to use , why care the init size 这样不是更好吗?可以节省内存啊?为什么别人不这么产生对象呢 |
| 2. | Object is created and referenced by the variable . at that point the 该方法执行一次,一个新的stringbuffer将被创建并且被sb变量引用。 |
| 3. | Object , and now it can be garbage collected . this elimination of the reference is equivalent to nulling the 于是不再有对该stringbuffer对象的引用,现在它就可以被当作垃圾收集了。 |
| 4. | Object created in the first line . as long as the method is executing , the reference to the 当该方法执行时,运行时栈保留了一个对stringbuffer对象的引用,这个对象是在程序的第一行产生的。 |
| 5. | Is being held onto by the application for much longer than it needs to be - possibly forever if no one ever calls 也就是说,这个死亡的stringbuffer对象被程序保留的时间比它实际需要保留的时间长得多如果再也没有对该scopingexample方法的调用,它将会永远保留下去。 |
| 6. | Where possible , it is recommended that this class ( stringbuilder ) be used in preference to stringbuffer as it will be faster under most implementations 是否是以不同的观点、方式或其它专业的效能测试工具做测试。因为依本文所测得的结果,两项类别所产生的实体在操作上并无明显的效能差异。 |
| 7. | When manipulating strings , use stringbuffer instead of string concatenation due to the immutable nature of string objects , and the need to create an extra string object that eventually must undergo gc 在处理字符串时,使用stringbuffer而不使用字符串连接,因为字符串对象具有不可变的特性,并且需要创建额外的字符串对象,而这些对象最终必须经历gc 。 |