This program is pretty small, but in large programs String concatenation can be a pretty large performance hit / memory drain. It's all because String is final and every concatenation creates a new object that has to be garbage collected. Check out the two videos below. They explain in detail:
http://tv.launchcode.us/#/videos/java_strings_performance?lesson=Java
Thanks for the tip, I should have it up and running now with stringBuilder instead of concatenation and I will try to remember that for the future. Thanks again.
Hey Adam,
This program is pretty small, but in large programs String concatenation can be a pretty large performance hit / memory drain. It's all because String is final and every concatenation creates a new object that has to be garbage collected. Check out the two videos below. They explain in detail: http://tv.launchcode.us/#/videos/java_strings_performance?lesson=Java
Cheers, Mike