You're mixing two different things. ("a" "b")
looks like it's two strings, but it's really only one; string literals separated by whitespace are automatically concatenated to a single string. It's identical to using ("ab")
.
On the other hand, you can add two different strings to make a new single string. That's what's happening with ("d"+str1)
.
The trick in the first example only works with string literals, not with variables or more complicated expressions. So ("d"+str1 "e")
doesn't work. You need ("d"+str1+"e")
, which is two additions.
P.S. the parentheses are optional, they just group together operations that don't need any additional grouping.