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
Do it like this without using a third variable:
String a = "one"; String b = "two"; a = a + b; b = a.substring(0, (a.length() - b.length())); a = a.substring(b.length()); System.out.println("a = " + a); System.out.println("b = " + b);