What is the difference between new Date() and Date.from(Instant.now()) in Java?

Viewed 688

I know that:

  • new Date() was the old way of creating Date objects.
  • Date.from(Instant.now()) is available since Java 8.

Since both of the above statements return the current date, is there any other difference between them? Or if I can have any other benefits using the second approach.

Also, which approach is the recommended way to use considering the performance?

0 Answers
Related