In this video, we'll learn about the functionalities of Period and Duration offered by Java Date/Time API. Code in Github : github.com/lah... Subscribe and Enjoy.
Java allows you to call static methods through an instance reference. Each individual method would simply create a new instance. At the end, period variable would hold the instance that was produced by the very last call to the static factory method - ofDays. Any intermediate objects that were created are dismissed since they won't have any references to them.