@@ -0,0 +1,1259 @@
+package com.levelup.java.string;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport org.junit.Test;%0A%0A/**%0A * This java snippet will demonstrate how to %0A * concatenate strings.  It is recommended that%0A * when concatenating large strings to use %7B@link StringBuffer%7D%0A * OR %7B@link StringBuilder%7D.  The difference b/t%0A * %7B@link StringBuffer%7D and %7B@link StringBuilder%7D is %0A * that %7B@link StringBuffer%7D is synchronized. %0A * %0A * @author Justin Musgrove%0A * @see %3Ca href='http://www.leveluplunch.com/java/'%3E%3C/a%3E%0A * %0A */%0Apublic class ConcatenateStrings %7B%0A%09%0A%09@Test%0A%09public void concatenate_strings_java () %7B%0A%09%09%0A%09%09String one = %22one%22;%0A%09%09String two = %22two%22;%0A%09%09%0A%09%09assertEquals(%22onetwo%22, one + two);%0A%09%09%0A%09%7D%0A%0A%09@Test%0A%09public void concatenate_strings_with_concat_java () %7B%0A%0A%09%09String one = %22one%22;%0A%09%09String two = %22two%22;%0A%0A%09%09assertEquals(%22onetwo%22, one.concat(two));%0A%09%09%0A%09%7D%0A%0A%09%0A%09@Test%0A%09public void concatenate_strings_with_stringbuilder_java () %7B%0A%09%09%0A%09%09StringBuilder sb = new StringBuilder();%0A%09%09sb.append(%22one%22);%0A%09%09sb.append(%22two%22);%0A%09%09%0A%09%09assertEquals(%22onetwo%22, sb.toString());%0A%09%09%0A%09%7D%0A%0A%09@Test%0A%09public void concatenate_strings_with_stringbuffer_java () %7B%0A%0A%09%09StringBuffer sb = new StringBuffer();%0A%09%09sb.append(%22one%22);%0A%09%09sb.append(%22two%22);%0A%09%09%0A%09%09assertEquals(%22onetwo%22, sb.toString());%0A%09%09%0A%09%7D%0A%0A%7D%0A

add concatenate strings