-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.3.0
-
x86
-
windows_nt
Name: stC104175 Date: 03/06/2000
Java version 1.3.0rc1
Compiling and executing the code below with the computer date set to February 29
produces the following output:
DAYS IN FEB 1999 ARE = 31
DAYS IN FEB 2000 ARE = 31
Process leaptest finished
Whereas executing the code with the computer date set to any other "non-leap"
day produces the correct output:
DAYS IN FEB 1999 ARE = 28
DAYS IN FEB 2000 ARE = 29
Process leaptest finished
This behavior seems to hold for other leap and non-leap years as well.
-----------------CODE----------------------
import java.lang.*;
import java.util.*;
public class leaptest
{
public static void main(String args[])
{
Calendar c = Calendar.getInstance();
c.set(Calendar.YEAR, 1999);
c.set(Calendar.MONTH, Calendar.FEBRUARY);
System.out.println("DAYS IN FEB 1999 ARE = "
+ c.getActualMaximum(Calendar.DAY_OF_MONTH));
c.set(Calendar.YEAR, 2000);
System.out.println("DAYS IN FEB 2000 ARE = " +
c.getActualMaximum(Calendar.DAY_OF_MONTH));
}
}
(Review ID: 102048)
======================================================================