Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

8. String concatenation
As in Java, you can concatenate Strings with the "+" symbol. But Java only needs that one of the two items of a "+" expression to be a String, no matter if it's in the first place or in the last one. Java will use the toString() method in the non-String object of your "+" expression. But in Groovy, you just should be safe the first item of your "+" expression implements the plus() method in the right way, because Groovy will search and use it. In Groovy GDK, only the Number and String/StringBuffer/Character classes have the plugs plus() method implemented to concatenate strings. To avoid surprises, always use GStrings.

...