views:

66

answers:

1

here is the relevent code snippet:

public static Rand searchCount (int[] x) 
{
    int a ; 
    int b ; 
    int c ; 
    int d ; 
    int f ; 
    int g ;
    int h ; 
    int i ; 
    int j ;
    Rand countA = new Rand () ;
        for (int l= 0; l<x.length; l++) 
        {
            if (x[l] = 0) 
            a++ ;
            else if (x[l] = 1) 
            b++ ;
        }
    }
    return countA ;

}

(Rand is the name of the class that this method is in)

when compiling it get this error message:

Rand.java:77: illegal start of type
        return countA ;
        ^

what's going wrong here? what does this error message mean?

+6  A: 

You have a misplaced closing brace before the return statement.

codaddict
yup that was it. thanks
David
Additionally, if (x[l] = 0) may not be intended, did you mean if (x[l] == 0) ?
Chris Dennett
@ chriss, yes. thanks for spotting that.
David