I\'m trying to understand what the best practice is and why for concatenating string literals and variables for different cases. For instance, if I have code like this
Use +
operator is best practice, it is also simple and readable.
The Java language provides special support for the string concatenation operator ( + ), and for conversion of other objects to strings. String concatenation is implemented through the StringBuilder(or StringBuffer) class and its append method.
Offical document: https://docs.oracle.com/javase/8/docs/api/java/lang/String.html