Reputation: 412
Why is LocalDate
not changing even though there is no error during running?
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate date = LocalDate.parse("2005-12-12", formatter);
date.plusDays(3);
System.out.println(date.toString());
Output:
2005-12-12
Anything I missed out?
Upvotes: 2
Views: 1590
Reputation: 21975
As a String
, it doesn't have an effect calling a method on it without assigning the result :
date = date.plusDays(3);
Upvotes: 1