1. First and foremost thing, Java is pass by Value.( ie Pass by Copy).
2. You are passing the reference Not the Object to the method.
Eg:
public class Test{
private String x;
public void go(String s){
this.x = s;
}
public static void main(String[] args){
Test t = new Test();
String a = new String("Bye");
t.go(a);
}
}
The above code is not to show how swapping is done, but to make an important point visible.
When go(String s) method is called by passing an Argument "a" which is an Object reference variable of type String to the Parameter "s" which is also an Object reference variable of type String, its just the reference that is passed by Value / Copy.
Any changes done on the reference will effect the String object on the Heap, NOT the reference.