I am half way in Head first java.. and trying out the pool puzzle on page 396. for the amazing shrinking blue rectangle.
I am using eclipse to complie and run my programs. but it doesnt seem to recognize the inner class MyDrawP. I am getting the error MyDrawP cannot be resolved to a type. Please let me know where I am making the mistake?
(I have enclosed your source with a "code" tag. Please use it the next time you post some code.)
You have declared the inner class inside a method. I don't know how the code looks in your book, but if you want to use an inner class that way, you'll have to declare the class before using variables of that class. Like this :
Are you sure that the MyDrawP class is inside the go() method ?
Joined: Jan 05, 2009
Declaring the inner class before the variables removed the error. Thanks.
and yes the inner class is declared in go() and it is given at the end of the method in the book.