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:
MagicHat.Rabbit rabbit = oldHat.new Rabbit(); // Create rabbit objects
the compiler could not compile and throws an error:
TryNestedClass.java:8: error: qualified new of static class
MagicHat.Rabbit rabbit = oldHat.new Rabbit(); // Create rabbit
How do i solve this? Thanks
I solved it. I made a silly mistake of declaring my nested class as static. Moderator pls close thread thanks.