• Post Reply Bookmark Topic Watch Topic
  • New Topic

Good reading on inner/outer classes  RSS feed

 
Rajinder Yadav
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I sent out a note to Paul Wheatson, who wrote, "Getting in Touch with your Inner Class". I found a typo and he asked me to post my reply here to get a discussion going... I think he just wants more people to read his article
Basically the typo states you can create an inner class with the following statement:
Inner i = new Outer().new Inner();
But the correct syntax is,
Outer.Inner i = new Outer().new Inner();
The only time you could use,
Inner i = new Outer().new Inner();
is if the statement was made from inside the outer class, not outside of it as he is doing from class TestMe.
For those of you who don't quite get inner and outer class, I suggest you read it, it can be found under the "Campfire" link on JavaRanch.
Enjoy!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!