Hi. I'm trying to understand inner and nested classes and have started by reading the "Getting in Touch with your Inner Class" campfire tutorial:
http://www.javaranch.com/campfire/StoryInner.jsp
I compiled the classes Outer and TestMe and ran TestMe with the correct output.
Immediately under that example, the tutorial goes on to say:
You can also instantiate both the outer class and inner class at the same time:
So, in class TestMe I commented out these two lines:
And inserted this line instead:
However, now class TestMe does not compile.
I then changed the statement to this:
The class TestMe again compiles and runs with the correct output.
Am I misunderstanding something in the campfire tale, or is this statement in the tutorial a bug? That is, Inner i needs to be changed to Outer.Inner i in the code snippet below.
You can also instantiate both the outer class and inner class at the same time:
Thanks.