Java Question about Copy Constructor
<p>I hope you will help me understand this <code>Copy Constructor</code> I took more then 2 hours reading reading on websites and I didn't understand anything about it.</p>

<p>I know that a copy constructor is used to copy an object of a class. But I don't understand the code of the copy consturctor.</p>

<p>For Example:</p>

<pre><code>public class Rectangle 
{
    private double length = 10.0;
    private double width = 10.0;


    public Rectangle(double length, double width){
        this.length = length;
        this.width = width;

    }
   //this is the copy constructor  what exactly the argument here? is it the object ref it self? please explain what happening here. and the use

    public Rectangle(Rectangle ref){
        this.length = ref.length;
        this.width = ref.width;
    }
</code></pre>

<p>this is what I see all the time. but I don't understand the code at all!
<code>ref</code> is it going to be created in the main program?</p>

<p>let say this is the main program</p>

<pre><code>public class rectangleTest{ 
public static void main(String[] args){
//is this new_ref object going to be created here?

Rectangle new_ref = new Rectangle(10.0 , 10.0);
</code></pre>

<p>This thing will not 100% clear to me unless if someone make a small class and main class showing me what's happening </p>

<p>Thank you.</p>
