Good day! While studying at level 8, JavaRush found out that the class
Date
is 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
, LocalTime
and 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. First, 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.
GO TO FULL VERSION