incompatible types in java

Posted by user2975357 on Stack Overflow See other posts from Stack Overflow or by user2975357
Published on 2013-11-10T03:20:27Z Indexed on 2013/11/10 3:53 UTC
Read the original article Hit count: 76

Filed under:

Should I point out that I am a begginer at this?

double averageMonthlyTemp() {
    double[] amt = new double[52];
    int sum = 0;
    int index = 0;

    for (int i = 0; i < temp.length - 1; i = i + 7) {
        //where temp is an existiing
        //previously initialized array 
        //of 365 elements, form 0 to 364
        for (int j = 0; j < 7; j++) {
            sum = sum + temp[i + j];
            if (j % 7 == 6) {
                double average = ((double) sum) / 7;
                amt[index] = average;
                index++;
                sum = (int) 0;
            }
        }
    }
    return amt;
}           

When I try to compile, I get an "incompatible types" error, with the "amt" at return amt marked in red. Does somebody know why?

© Stack Overflow or respective owner

Related posts about java