StringBuffer and String
Webpshere Best Practices: "String concatenation is the textbook bad practice that illustrates the adverse performance impact of creating large numbers of temporary Java objects. Because Strings are immutable objects, String concatenation results in temporary object creation that increases Java garbage collection and consequently CPU utilization as well. The textbook solution is to use java.lang.StringBuffer instead of string concatenation."
Take from the The Server Side
Being immutable means that that once Strings are created they can not be changed. Operations that appear to modify String objects actually generate completely new ones.
The creation of new String objects occurrs for:
- overlaoded mathematical operations
No comments yet.