Two Strings in java can combine together with simple adding of two strings with each. Concatenate String in java requires two string and put plus operator between it.
String string1="String one"; String string2="Merge with second string"; String combineString=string1 + string2; System.out.println(combineString); StringBuilder sb1 = new StringBuilder("String builder string 1 "); StringBuilder sb2 = new StringBuilder("And string 2 "); StringBuilder combineStringBuilder = sb1.append(sb2); System.out.println(combineStringBuilder);
Tags: String




Link to Us