How to change an object from a method within its class
<p>In java, is it possible to change an Object instance from within a method of its class? I would like to do something like this:</p>

<pre><code>public void setMix(MyColor[] colors){

    MyColor colorMix = MyColor.colorMixer(colors);

    // Instead of this
    this.red = colorMix.getRed();
    this.blue = colorMix.getBlue();
    this.green = colorMix.getGreen();

    // I would like to do something like:
//  this = colorMix; 
    // which is not allowed

}



public static MyColor colorMixer(MyColor[] colors){

    int red = 0;
    int green = 0;
    int blue = 0;

    ...
    // Here I work with the colors array to compute three new components


    return new MyColor(red, green, blue);
}
</code></pre>

<p>Is there a nice way to do that? Thanks a lot!</p>

<p>[I'm sure this question should have been answered before, but I couldn't find it, I'm sorry if it's the case]</p>
