Moon Light Box

Time is Money

Java - concat vs append

| Comments

concat():
String has concat method, remember string is immutable.
It adds a string to another string.
It will create the new object after concatenation done, since it is a immutable.

append():
StringBuilder and StringBuffer has append method, remember these two are mutable.
It appends a char or char sequence to a string.
It will not create a new object, since it is a mutable one.

https://stackoverflow.com/questions/25138587/what-is-difference-between-mutable-and-immutable-string-in-java

http://pydoing.blogspot.tw/2011/01/java-concat.html

http://javadomain.in/ifference-between-concat-and-append-in-java/

http://stackoverflow.com/questions/8962482/yet-again-on-string-append-vs-concat-vs

http://stackoverflow.com/questions/8755063/concatenation-operator-vs-concat?lq=1

http://stackoverflow.com/questions/8962482/yet-again-on-string-append-vs-concat-vs

answer
http://stackoverflow.com/questions/14927630/java-string-concat-vs-stringbuilder-optimised-so-what-should-i-do

java

Comments

comments powered by Disqus