• Post Reply Bookmark Topic Watch Topic
  • New Topic

Anonymous inner class  RSS feed

 
Shiva Mohan
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



I am trying to understand anonymous inner class.I couldn�t figure out to solve the following error at line 1.

symbol : variable b
location: class Bing
KAndBExam1 myKAndBExam1=myBing.b;
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
myBing is a Bing. It has no variable b. The base class Bing knows nothing about any of its subclasses.
 
Shiva Mohan
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Garrett thanks for the reply.OK.But how can I access anonymous class which is created in KAndBExam1.At line 1,what would I need to work ?
 
Henry Wong
author
Sheriff
Posts: 23284
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The way your KAndBExam1 class is written, I don't think you can instantiate one. When you try to instantiate one, it should recursively try to create another one, which recursively try to create another one, which ... until you run out of memory.

Henry
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shiva, your problem is not related to anonymous inner classes at all. You would have exactly the same problems if you used only top level classes in your example code.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!