在append(object)时都是一样在栈中处理吗?

解决方案 »

  1.   

    A mutable sequence of characters. This class provides an API compatible with StringBuffer, but with no guarantee of synchronization. This class is designed for use as a drop-in replacement for StringBuffer in places where the string buffer was being used by a single thread (as is generally the case). Where possible, it is recommended that this class be used in preference to StringBuffer as it will be faster under most implementations. 
    可能最大的区别是关于同步的问题,也就是线程安全的问题吧,前者不同步,后者同步,所以前者相对来说效率应该更高一点
      

  2.   

    String 是不可变长的,修改String对象就等于创建新的String对象。
    而 StringBuffer 是可变长的。我的BLOG有更详细的:http://blog.csdn.net/jeader
      

  3.   

    楼上的看来是位高手,不过楼主问的是StringBuffer和StringBuilder的区别
      

  4.   

    StringBuilder?java里有吗?我知道.net里倒是有这个东西,不过没啥区别
      

  5.   

    看源码吧,
    手头没有源代码,
    以前大致流览过一点,好像 StringBuffer  把有关于空间申请更新等操作的放到StringBuilder 
     
    不想装 1.5了
      

  6.   

    涨见识了,我最高就用过1。4,后来就没怎么作java了。nnd,不是俺不努力啊,各项技术都变化太快,哪儿学的完啊。
      

  7.   

    从文档上来看,StringBuilder和StringBuffer是兼容的,只是前者非线程安全,后者线程安全。建议一般使用前者
      

  8.   

    不同一楼上的看法,虽然StringBuilder和StringBuffer是兼容的,前者非线程安全,后者线程安全。但是使用时要看情况而定  String 也一样