i think i see your problem - the only return statements in your method are wrapped up in an if-else block, and the compiler isn't smart enough to understand that either the "if" or the "else" will necessarily be executed. it thinks there might be some way for control to pass by the whole "if" statement entirely, in which case it would fall off the end of the method without ever "return"ing anything.

the easy way to fix this is to put in a bogus, unreachable return statement after the end of the "else" block, just before the closing brace of the method. this should make the compiler happy.

on edit: there is also a hard way to fix your problem, which would involve thinking about the structure of your code. look at the "while" loop, specifically, and ponder whether or not it is really needed. how many times will it run, and why? [ May 21, 2005: Message edited by: M Beck ]

miguel lisboa

Ranch Hand

Posts: 1281

posted 12 years ago

imagine that boolean stop allways evaluates true; in that case the loop never executes, and so never outputs a return statement...

so,after your while end bracket write:

return myInt;

hope this helps

java amateur

Nicholas Censored

Greenhorn

Posts: 2

posted 12 years ago

V�dret �r mulet liksom �lgens n�sa (mulen).

I solved my problem by rewriting the calling code and then removed the while-loop.