StringBuffer | String |
---|---|
It provides a mutable character sequence. | It provides an immutable character sequence. |
It is possible to insert characters and substrings in the middle or at the end of the string. | It is not possible to insert characters and substrings in the middle or at the end of the string. |
It reserves room for 16 characters without reallocation. | It does not reserve room for characters. |
It uses the ensureCapacity(), delete(), deleteCharAt(), append(), insert(), and reverse() methods. | It is not possible to use these methods on strings because they are immutable. |
Welcome to the Java Blog, written by me with the sole purpose of talking about Java & Web technologies. I'm aiming this blog at other Java developers with the deeper aspects of writing code and resolving technical issues. Hopefully I can blog about some really interesting topics as I come across them. Mr. Patricia Seybold said, "If you learn to program in Java, you’ll never be without a job!"
Friday, May 29, 2009
Differences between StringBuffer and String
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment