I wrote my code as follows for this problem:

public class Solution {

public int singleNumber(int[] A, int n) {

int result = A[0];

for (int i = 0; i < n; i++) {

result ^= A[i];

}

return result;

}

}

After submitting, it showed

Line 20: error: method singleNumber in class Solution cannot be applied to given types;

I have no idea about the error.