| Author |
String Builder Class
|
Vishal Hegde
Ranch Hand
Joined: Aug 01, 2009
Posts: 984
|
|
what is the meaning of synchronized methods and
what does this sentence actualy mean-"StringBuilder class consists of mutable sequence of charecters"
and what does 'thread-safe' mean
|
http://www.lifesbizzare.blogspot.com || OCJP:81%
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12950
|
|
Have a look at Synchronization in Sun's Java tutorials.
A piece of code is thread-safe if it still works correctly when multiple threads execute it at the same time. (Click on the link, the Wikipedia article explains it in much more detail).
About "StringBuilder class consists of mutable sequence of charecters": Class StringBuilder contains a sequence of characters, which you can modify - unlike for example class String, which is immutable.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
|
If you read the StringBuilder documentation, you find it has lots of methods called "delete" or "insert" or "append" with void return types. It allows you to alter the contents of "writing" and then turn it to a String with the toString() method.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
Campbell Ritchie wrote:lots of methods called "delete" or "insert" or "append" with void return types.
Not void, StringBuilder. These methods return another reference to the StringBuilder object itself that allows you to chain methods. For example:
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
|
Yes, Rob, I had forgotten about the return types. Sorry.
|
 |
 |
|
|
subject: String Builder Class
|
|
|