java Pair and ArrayList question
<p>I already asked this question and I got additional question about using 
class I made myself.
see code below.</p>

<pre><code>  import java.util.*;

    class Pair{
      int toWhere;
      int weight;
    }

    public class Test{
      public static void main(String[] args){
        ArrayList[] arr = new ArrayList[2];
        Pair p = new Pair();

        for(int i=0; i&lt;arr.length; i++)
          arr[i] = new ArrayList&lt;Pair&gt;();

        p.toWhere = 1;
        p.weight = 2;
        arr[0].add(p);
        System.out.println(p); // gives me Pair@525483cd
        System.out.println(arr[0].get(0)); // gives me exactly the same, Pair@525483cd
        System.out.println(p.toWhere); // gives me no error, and is 1
        System.out.println(arr[0].get(0).toWhere); // gives me an error
      } 
    }
</code></pre>

<p>my question is this.
values of p and <code>arr[0].get(0)</code> (which is address? I guess) is the same.
but why does <code>p.toWhere</code> give me the accurate value and 
<code>arr[0].get(0).toWhere</code> does not?</p>
