previous | start | next

## String concatenation

- `+` operator concatenates strings:

      "Hello, " + name

- If one argument of `+` is a string, the other is converted into a string:

      int n = 7;
      String greeting = "Hello, " + n;
       // yields "Hello, 7"

- `toString` method is applied to objects

      Date now = new Date();
      String greeting = "Hello, " + now;
       // concatenates now.toString()
       // yields "Hello, Wed Jan 17 16:57:18 PST 2001"

previous | start | next