You problem is that java is pass by VALUE not reference. So you can't write a swap function the way you did.
you could do something like
class CatContainer {
Cat cat1;
Cat cat2;
CatContainer(Cat cat1, Cat cat2) {
this.cat1 = cat1;
this.cat2 = cat2;
}
...
}
and then have a method
public static void swapCatsInContainer(container) {
Cat tmp = container.getCat1();
container.setCat1(container.getCat2());
container.setCat2(tmp);
}
something like that. Now in the scope that called swapCatsInContainer
cat1 and cat2 are swapped.