If I code like this:
Period wrong = Period.ofYears(1).ofWeeks(1);
It gives output of P7D.
By the implementation of Period class we know that all of____() methods are static.
But if you to do same chaining with DateTime class:
LocalDate date = LocalDate.of(2020, Month.JANUARY, 20);
LocalTime time = LocalTime.of(5, 15);
LocalDateTime dateTime = LocalDateTime.of(date, time)
.minusDays(1).minusHours(10).minusSeconds(30);
All minus___() and plus___() methods are instance methods in LocalDateTime class.
Question: why is method chaining not allowed for the Period class?
Why the Period class isn't supporting that?
How the internal assignment is going on ?