summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/hjp5/examples/Listing1104.java
blob: 338e8e02eca66c950534b79926d67f6aeeadd45d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* Listing1104.java */

public class Listing1104
{
  public static void main(String[] args)
  {
    String a, b, c;

    //Konventionelle Verkettung
    a = "Hallo";
    b = "Welt";
    c = a + ", " + b;
    System.out.println(c);

    //So k�nnte es der Compiler �bersetzen
    a = "Hallo";
    b = "Welt";
    c =(new StringBuilder(a)).append(", ").append(b).toString();
    System.out.println(c);
  }
}