Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Anonymous inner class

 
Faisal Ahmad
Ranch Hand
Posts: 355
Chrome Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please tell me what's wrong with the following code? Im showing the source of 2 errors
 
Dustin Johnson
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For one, it looks like you're trying to create two instances of variable named "p" as Popcorn types, your second one isn't an anonymous class from my discernment. It is clearly type Popcorn, and I'm not quite sure what the code block there is for me, as you are not creating an anonymous class just creating a new Popcorn() object...
[ March 08, 2007: Message edited by: Dustin Johnson ]
 
Faisal Ahmad
Ranch Hand
Posts: 355
Chrome Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont think my code is wrong where you've pointed it. Well, to make things more clear look into this code now:

Just removed ambiguity..still the same errors!
 
Faisal Ahmad
Ranch Hand
Posts: 355
Chrome Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it!
Well, while overriding a method, we've to maintain the signature and not pass the arguments. Arguments should be passed during the method call.
Herez the updated code:

Sorry for the stupidity!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic