If I understand correctly you're asking about how using StringBuilder differs from normal String concatenation (rather than some compiler/IDE optimisation).
Strings in Java are immutable, meaning that once they're created they cannot be modified. Therefore when you perform some operation on a given string - such as String.concat() or String.replaceAll() which look on first glance that they will alter the string's internal state - you are in fact creating a new string object which is derived from the original immutable object, and as such that has to be saved somewhere.
String example = "This is a test "; example = example.trim(); // "This is a test"
Often such operations aren't terribly expensive but if you have to due a lot of String modification then using this approach can end up being very costly with all the object creation.
The alternative is to use a class like StringBuilder which represents mutable character sequence. With this class it is possible to modify the instance itself. So concatenation via the 'StringBuilder.append()' method is must cheaper in CPU/memory terms compared to 'String.concat()'. Of course, once you've finished constructing your StringBuilder you'll often want to get a normal String, hence its toString() method.
Another handy aspect of StringBuilder is that it uses method chaining so that its methods returns itself and that allows you to chain calls in one line.
StringBuilder b = new StringBuilder(); b.append("One"); b.append("Two"); b.append("Three").append("Four");
This can make certain things more readable, eg
StringBuilder sb = new StringBuilder(); sb.append(user.getLastName()).append(", ").append(user.getFirstName()); // Better than mixing String concatenation sb.append(user.getLastName() + ", " + user.getFirstName()); // Valid but defeats purpose of using StringBuilder
argsinto one String it would look something like that. It means the JVM will use a StringBuilder to perform String concatenation, since Java String(s) are immutable.