• Post Reply Bookmark Topic Watch Topic
  • New Topic

inner classes  RSS feed

 
kurian chacko
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the use of anonymous classes? difference between anonymous & inner classes...I think looking at the coding they both look similar only difference is the syntax...I want to know if i am right..
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An anonymous class is the only way to directly implement an interface (or use 'new' on an interface for that matter).

I mostly use them if I only need the behavior for this particular thing and nothing else.

So instead of..


I would use




I think you get the idea. ..
 
kurian chacko
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank u. i got it....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!