[Bluej-discuss] Exercise 10.14 page 276
Luis Moreira
Luis.Moreira at jet.uk
Wed Apr 5 08:45:54 BST 2006
Hi all,
I am trying to do exercise 10.14 and I am having a problem with a
variable declaration.
This variable is declared inside aa while loop in the findFood method in
Class Fox:
Location where = (Location) adjacentLocations.next();
When I try to return this variable with: return where, which is outside
the while loop, I get an error because the compiler can not find this
variable.
I understand why is doing it, but apart from declaring this variable on
the beginning of the method is there any other way to make it work.
Best regards
Luis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.bluej.org/pipermail/bluej-discuss/attachments/20060405/ce6ef58d/attachment-0001.html
More information about the bluej-discuss
mailing list