Hi, I have a problem with some of my code and i just cant see what going on...
I am calling this method, Drawable is an interface and in the if i am checking if the coordinate object passed is within the shape of an object drawn before. But i keep getting method does not return a value, can sombody please help
If you notice your return part of code is within an if clause. What happens IF the case isn't true? Then nothing is returned. Hope that helps.
Joined: Aug 24, 2002
i added an else with a return but its not made a difference and if i add a continue then i might get caught in an infinite loop
Joined: Oct 01, 2002
It is the same kind of problem, different loop. Your program says: while(iter.hasNext()) What if iter doesn't have a next? Then it won't even execute the if nor the else part. See what I mean? It would avoid it altogether and jump out of the while loop and return nothing. Sorry for missing that!