title: Initialize an object of another class in constructor
body: <p>For example, I have the following class that implements the Icon interface. In the constructor, it initializes the Color object by creating a deep copy of the Color object supplied in the parameter. </p>
  
  <pre><code>   public class CircleIcon implements Icon {
          private Color iconColor;
          private int radius;
  
          public CircleIcon(Color iconColor, int radius) {
              this.iconColor = new Color(iconColor.getRGB());
              this.radius = radius;
          }
      }
  </code></pre>
  
  <p>My question is: Is this a proper way to initialize object of another class? I often see things like this in other people's code. In here, this.iconColor gets the reference of the Color object supplied in the parameter instead of its copy.      </p>
  
  <pre><code> public CircleIcon(Color iconColor, int radius) {
          this.iconColor = iconColor;
          this.radius = radius;
   }
  </code></pre>
  
  <p>I would like to know which way is preferred.</p>