I am trying to swap two strings in Java. I never really understood \"strings are immutable\". I understand it in theory, but I never came across it in practice.
Also
String s1 = "Hello"; String s2 = "World"; s1=s1+" "+s2; s2=s1.split(" ")[0]; s1=s1.split(" ")[1]; System.out.println(s1 + " " + s2);