How do I swap two string variables in Java without using a third variable, i.e. the temp variable?
String a = \"one\" String b = \"two\" String temp = null; temp
Jj Tuibeo's solution works if you add replaceFirst() and use a regular expression:
a += b; b = a.replaceFirst(b + "$", ""); a = a.replaceFirst("^" + b, "");