title: Assigning values to java object
body: <p>I have the following code:  </p>
  
  <pre><code>Color3D pixel = new Color3D(200, 0, 0);  
  Color3D temporal  = pixel;  
  System.out.println(util.printColor("Pixel: ", pixel));  
  System.out.println(util.printColor("Temporal: ", temporal));  
  pixel.setR(0);  
  pixel.setG(200);  
  pixel.setB(0);  
  System.out.println(util.printColor("Pixel: ", pixel));  
  System.out.println(util.printColor("Temporal: ", temporal));  
  </code></pre>
  
  <p>Result:  </p>
  
  <pre><code>Pixel: r: 200, g: 0, b: 0  
  Temporal: r: 200, g: 0, b: 0  
  Pixel: r: 0, g: 200, b: 0  
  Temporal: r: 0, g: 200, b: 0  
  </code></pre>
  
  <p>My class Color3D saves RGB (int)values.<br>
  I use the object util to print the int values of a Color3D object.  </p>
  
  <p>If you look at the result, for some reason after changing the red and green values of the pixel object I'm also modifying the green's values and I don't want that behaviour.  </p>
  
  <p>I want to have:  </p>
  
  <pre><code>Pixel: r: 200, g: 0, b: 0  
  Temporal: r: 200, g: 0, b: 0  
  Pixel: r: 0, g: 200, b: 0  
  Temporal: r: 200, g: 0, b: 0  
  </code></pre>
  
  <p>The object temporal was created with the intention of saving the pixel object values for a future process. The object temporal will also change in future...  </p>