Which of the following below is true for StringBuffer?

Options
- Both b and c
- When an application is to run a single thread using some changes for strings, it is advisable to use StringBuffer
- StringBuffer class is not synchronized
- StringBuffer is thread safe


CORRECT ANSWER : StringBuffer is thread safe

Discussion Board
StringBuffer

StringBuffer is thread-safe, mutable sequence of characters. It is in the form of string but it can be modified and at any point of time it consists of some particular sequence of characters. The length and the content of the sequence can be changed through certain methods. In multi-threaded system stringbuffer are safe to be used as they are synchronized wherever necessary and all the operations can be done on a particular instance. The operation performed by StringBuffer is as follows:
Append
Insert

Rohit Sharma 08-1-2014 06:46 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement