I'm trying to create a Date
like this:
date = new Date(year-1900, mon-1, day, hrs, min, sec);
and Eclipse gives me this warning: "The constructor Date(int, int, int, int, int)
is deprecated".
What does it mean for a constructor to be deprecated, and what can I do?
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.