Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-1246283

java.util.Date constructor rejects valid year values

XMLWordPrintable

    • 1.1
    • sparc
    • solaris_2.5
    • Not verified


      The year 1963 is rejected as invalid ; see test code below:


      import java.sql.*;

      class DateTest {

          public static void main (String args[]) {

      java.util.Date date;

      date = new java.util.Date(63, 4, 13);

      java.lang.System.out.println("Date: " + date);

      }
      }

      java DateTest
      java.lang.IllegalArgumentException: year out of range.
      at java.util.Date.<init>(Date.java)
      at java.util.Date.<init>(Date.java)
      at DateTest.main(DateTest.java:9)

      Compilation finished at Tue Apr 16 14:08:55

            duke J. Duke
            mhapnersunw Mark Hapner (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: