The roll method of the Calendar class specifies which part of the date to change in the first argument and the change value in the second argument.
If there is a variable with 4/1 set, what happens to the value of the variable when it is executed with "day" as the first argument and "-1" as the second argument of the roll method?
It is likely to be 3/31 because the day goes back one day, but it will actually be 4/30.
With the add method, it seems to be 3/31.
Recommended Posts