Comparison of String and StringBuilder manipulation in terms of memory usage
问题 According to SCJP Study Guide by KathySierra: The java.lang.StringBuffer and java.lang.StringBuilder classes should be used when you have to make modifications to strings of characters. As we discussed, String objects are immutable, so if you choose to do a lot of manipulations with String objects, you will end up with a lot of abandoned String objects in the String pool To clear out this, I have gone through the code of String class and StringBuilder source here. The simplfied code of String