Type a Period.between call and read its years
Type a Period.between call and read its years
Answer
Period age = Period.between(birthday, LocalDate.now()); int years = age.getYears();
Period.between takes two LocalDates. The result can be negative if the end is before the start. getYears() reads only the years component, not the total.