I have a pretty general question about java. I want to know if there is a simple way to recreate this c++ code in java:
class A 
{
public:
  int first;
  int second;
  A(const A& other) {
    *this = other;
  }
...
}
So basically a copy constructor where you can pass an existing object of A a new object of a in the constructor, and it will copy the contents and build an exact copy of the existing object of A.
trying
class A {
  int first;
  int second;
  public A(A other){        
    this = other;
  }
 ...
}
sadly doesn't work, since eclipse tells me "this" is not allowed on the left handside of an assignment since it's not a variable.
I know I would achieve the same results doing:
class A {
      int first;
      int second;
      public A(A other){        
        this.first = other.first;
        this.second = other.second;
      }
     ...
    }
But I would like to know if there is an easier way, since sometimes you have a few more class variables.
Thanks in advance!