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
The s1 and s2 variables in your function swap are local to that function.
You need to define s1 and s2 as private variables for your class, or return an array of strings from your function.