in java how to make sure the passed object is modified by only object to which it is passed?
<p>Suppose that I have a class which takes an array of Key object to construct an object of class keyHandler, like this:</p>

<pre><code>class KeyHandler {
    Key[] keys;
    public KeyHandler(Key[] keys) {
        this.keys=keys 
    }
    //more methods which modify key;
}
</code></pre>

<p>now I call this constructor from main</p>

<pre><code>KeyHandler keyhandler = new KeyHandler(keys);
</code></pre>

<p>I want to make sure that keys array is not modified from main(). How can I do this?</p>
