View Single Post
Old Mar 19, 2011 | 01:06 AM
  #4  
rpoint2012's Avatar
rpoint2012
Virgin
 
Joined: Mar 2011
Posts: 2
Likes: 0
From: Japan
Default

StriingBuffer is synchronized, it locks a thread every time you call it. StringBuilder is the newer Java 1.6 API, and it can run in its own thread. All three: String, StringBuffer, StringBuilder are Objects, they have methods.

int sLen = s.length()
int sbLen = sb.length();
int stbldrLen = stb.length();

The advantage of StringBuilder is it is faster in execution speed than...
String s = "r" + "u" + "n";
s += " Spot"
s += " run\n";

Java1.6+ uses StringBuilder internally when you call += on a String. But, each call on += is another String without StringBuilder and thus another 40 bytes minimum that never goes away.
=============
property management system
Retractable Banner Stands
Reply