Can java.util.Calendar be passed over method?
<p>this is my code:</p>

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

import java.util.Locale;

public class test {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Calendar a = Calendar.getInstance();
        a.set(Calendar.MONTH, 7);
        a.set(Calendar.YEAR, 2011);
        a.set(Calendar.DAY_OF_MONTH, 16);

        System.out.print(test.getDate(a));
    }

    // What-date calculation
    public static String getDate(Calendar date) {
        //date = Calendar.getInstance();
        return date.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG,
                Locale.getDefault());
    }

}
</code></pre>

<p>when I run this code, it prints "Tuesday". However, I run this code on July 16, 2011 and uncomment </p>

<pre><code>date = Calendar.getInstance();
</code></pre>

<p>so that <code>date</code> would be July 16, 2011 and it prints exactly "Saturday".</p>

<p>I wonder if the Calendar object <code>a</code> is passed correctly because <code>a</code> is also set July 16, 2011.
Is there any solution for me to pass Calendar object and print the date correctly? </p>

<p>Thank in advance</p>
