Thursday, January 5, 2012

STRINGBUILDER AND STRINGBUFFER

The java.lang package contains two classes for representing strings as a mutable sequence
of characters: StringBuilder and StringBuffer . The StringBuffer class has been around
since the fi rst version of Java, while StringBuilder was added in J2SE 5.0. The two classes
have the exact same method signatures and constructor parameters. The only difference
between them is that StringBuffer is thread - safe and StringBuilder is not. If you are
working with arrays of characters in a multithreaded application, use the StringBuffer
class. Otherwise, if threads are not an issue for your particular situation, use the String-
Builder class.

No comments:

Post a Comment