-1

I'm trying to code a clock in java and for april it says 3 instead of 4 why is that?

here is my code

Calendar c = Calendar.getInstance();
c.get(Calendar.MONTH)
Jyothi Babu Araja
  • 10,076
  • 3
  • 31
  • 38

1 Answers1

2

That is because the month January in java is "0"

Refer to this question if you wanna know what it is "0"

Why is January month 0 in Java Calendar?

Community
  • 1
  • 1
SamHoque
  • 2,978
  • 2
  • 13
  • 43