Why were most java.util.Date methods deprecated?

后端 未结 5 994
野趣味
野趣味 2020-11-27 18:36

When you look at the javadoc of the java.util.Date class, most of the methods are deprecated. Why was this done?

5条回答
  •  悲哀的现实
    2020-11-27 19:24

    They're deprecated because Date was written as fast as possible back in the day when they wanted to rush the JDK out the door.

    It turns out the Dates and Calendars are Hard. So, they created the Calendar class, which much more thought, in order to handle the Hard Parts of working with calendars.

    They deprecated the Date methods and delegated to Calendar because they didn't want to change the behavior of the existing Date methods, and possibly break existing applications.

提交回复
热议问题