JavaRush /Java Blog /Random EN /New class in JDK8 LocalDate, LocalTime
IvanSPb
Level 21
Brooklyn

New class in JDK8 LocalDate, LocalTime

Published in the Random EN group
Good day! While studying at level 8, JavaRush found out that the class Dateis obsolete and Intellij IDEA does not recommend using it. I searched and found recommended classes. Oracle has created a new API for working with dates and times. The main objects of the new API are the classes LocalDate, LocalTimeand LocalDateTime(the latter is a kind of combination of the previous two). The official oracle documentation advises to think of these classes as a calendar or a clock on the wall near you. New class in JDK8 LocalDate, LocalTime - 1First, let's create a couple of objects of these classes and see what they return to us toString():
LocalDate today = LocalDate.now();
LocalDate MyBirthday = LocalDate.of(1988, Month.APRIL, 3);
And here’s the question: why is the keyword not used when creating objects of new classes new? I've spent a lot of time and haven't found an answer yet. PS I also propose to change a number of exercises and lectures in connection with new realities - the emergence of new classes and the obsolescence of existing ones.
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION