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
public class ex{ public static void main(String[] args){ String s1="abc"; String s2="def"; System.out.println(s1); System.out.println(s2); s3=s2.replaceAll(s1,s2=s1); System.out.println(s1); System.out.println(s2); } }