You have declared
removingduplicates
as returning an array of integers:
public static int[] removingduplicates(int[] a, int n)
But you then declare
j
as a single integer value, and try to return it:
public class Duplicate
{
public static int[] removingduplicates(int[] a, int n)
{
...
int j=0;
...
return j;
}
...
}
Probably, what you wanted to return was
temp
instead of
j
?