Check out example codes for "java calcular años". It will help you in understanding the concepts better.

Code Example 1

public class PeriodClass { 
  
    // Function to calculate period between 
    // start and end date 
    static void calculatePeriod(LocalDate startDate, 
                                LocalDate endDate) 
    { 
        Period period = Period.between(startDate, endDate); 
        System.out.println("Period between start and end "
                           + "date is : " + period); 
    } 
  
    // Driver Code 
    public static void main(String[] args) 
    { 
        // Start date 
        LocalDate startDate = LocalDate.parse("2017-02-13"); 
  
        // End date 
        LocalDate endDate = LocalDate.parse("2018-08-20"); 
  
        calculatePeriod(startDate, endDate); 
    } 
}

Learn ReactJs, React Native from akashmittal.com