Arhaan Singhania wrote:Mathews, it was confusing definitely, just wondering, why would they keep it to zero
I can't be sure, but it's probably something to do with the zero-indexing of arrays/lists. It just happens to be so confusing because it goes against standard practice with dates, which everyone is familiar with.
One way to cope is to always use
Calendar.JANUARY as an offset. E.g. if you want to set the month to what you think of as the 9th month, you could use
calendar.set(Calendar.MONTH, 8 + Calendar.JANUARY), and it would work regardless of how it had been implemented. When you come back to the same code a year later, you won't have to remember why it's off by one.