I had an interesting question come up on a recent interview that I found rather enlightening, so I figured I would share. I was asked to explain the performance difference between the StringBuffer and String classes in Java. I dutifully explained that a String is immutable while a StringBuffer is not, but drew a blank […]