e hënë, 18 qershor 2007

Diff betw. String, StringBuffer & StringBuilder

String.
-----------------------
- mutable sequence of characters
- cant append or insert char/string in existing object, a new object will be created.
- its synchronized.
- for each substring or any operation, a new object is created and given its reference.

StringBuffer
-----------------------
- an immutable sequence of characters
- allows to insert, append char/string within the existing object.
- its synchronized.

StringBuilder
-----------------------
- has been introduced in J2SE 5.0
- its un-synchronized version of StringBuffer class.
- allows insert/append operations on string.
- mutable sequence of characters they are un-synchronized.

Nuk ka komente: