Java’s Date(…) constructor is deprecated; what does that mean?

Deprecated literally means disapproved of, but a more accurate translation would be retired. Deprecated means this method is still usable, but you should not use it. It will gradually be phased out. There is a new method to do the same thing. Deprecated methods are marked with a special Javadoc comment:

/**
 *@deprecated Please now use newMethod()
 *@see newMethod()
 */

Use:

  • Calendar.set(year + 1900, month, date, hrs, min)

or

  • GregorianCalendar(year + 1900, month, date, hrs, min).

As suggested by the API documentation.

Leave a Comment