I am writing one method having a prototype int. But the method shows an error in the editor, saying that Add a return statement , where the return statement is already present. When I add another return, it works fine. I am writing in an eclipse.
Here is my code:
private static int nextPrime(int n) {
if(n % 2 == 0)
n++;
for(; !isPrime(n); n+=2)
return n;
return n;
}
What is wrong here. Thanks for the help.
source
share