0

public class Tester {

 public static int[] findLeapYears(int year){
       //Implement your logic here and change the return value appropriately
     int[] findingYear = { };
     int i=0;
    do{
        
        if(year%4==0 && year%100!=0){
            findingYear[i] = year;
            ++i;
            year++;
            continue;
        }else if(year%100==0 && year%400==0){
            findingYear[i]=year;
            ++i;
            year++;
            continue;
        }else{
            year++;
        continue;
        }
        
        
    }while(i<15);
      
      return findingYear;
   }
    
   public static void main(String[] args) {
       int year = 2000;
       int[] leapYears;
       leapYears=findLeapYears(year);
       for ( int index = 0; index<leapYears.length; index++ ) {
           System.out.println(leapYears[index]);
       }
    }

}

i dont know why compiler throw exception error, someone please explain me!! i have to find 15 leap year form the current year.i tried this code and it looks logically correct for me but there is an runtime erorr.

jarvis
  • 29
  • 7

0 Answers0