Hi i tried Pg 218 example. The program failed to compile on both author's code and my own code (which are basically the same thing).
For the line:
Code:
MagicHat.Rabbit rabbit = oldHat.new Rabbit(); // Create rabbit objects
the compiler could not compile and throws an error:
Code:
TryNestedClass.java:8: error: qualified new of static class
MagicHat.Rabbit rabbit = oldHat.new Rabbit(); // Create rabbit
objects
^
1 error
How do i solve this? Thanks
EDIT 1:
I solved it. I made a silly mistake of declaring my nested class as static. Moderator pls close thread thanks.