I have a class written for Fraction objects. I need to swap two Fraction objects, not the contents of the objects. Here is my code.
public void fswap(Fraction other){
Fraction temp = other.copy();
other = this;
this = temp;
The copy() method returns a Fraction object identical to the object it was called on. The last line of this code throws an error in my IDE "cannot assign a value to final variable this". Any help is greatly appreciated.