This is “string concatenation,” and it is a bad practice: ... Some may say that it is slow, mostly because parts of the resulting string are copied multiple times. Indeed, on every + operator, String class allocates a new block in memory and copies everything it has into it; plus a suffix being concatenated.
Is string concatenation inefficient?
The concatenation is not that inefficient, because modern compilers replace it with an efficient implementation based on StringBuilder (you'll see it if you look at the classfile's bytecode).
Why is string concatenation expensive?
It's been costly. Let's first dig into the issue of why it's costly. In Java, string objects are immutable, which means once it is created, you cannot change it. So when we concatenate one string with another, a new string is created, and the older one is marked for the garbage collector.