Java Calendar.add in giving inconsistent results
<p>I am having the following code</p>

<pre><code>    Calendar calendar = Calendar.getInstance();

    calendar.set(2011, 7, 29);      //case 1    
   // calendar.set(2011, 7, 30);      //case 2
   // calendar.set(2011, 7, 31);    //case 3

    System.out.println("===After seting the date== "+calendar.getTime());

    System.out.println("=================================================================");

    calendar.add(Calendar.MONTH, 6);


    System.out.println("===result after adding 6 months==  "+calendar.getTime());
</code></pre>

<p>and for the case 2 and case 3 also i am getting the same results. it should overflow to next month and show the new date. but its not happening.</p>
