This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Anonymous Inner Class

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Is de same Anonymous Inner Class and Inner Class??
Thanks.
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jordi,
No way!
An anonymous class has no name.
An example:

An inner class can be any class defined inside another class. An example:

Regards,
Manfred.
 
kavita desai
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jordi,
you can have various inner classes. Anonymous Inner class is one of them.
1. member inner class. which a class inside a class with a name but not same as the enclosing class
2. local inner class. class inside a method, has a name.
3. anonymous inner class. does not have a name, used widely in connection with event handling.
4. you can also have an interface inside a class.
hope that explains,
kavita desai
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then, anonymous class is code without class??
 
kavita desai
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is rather class without a name. the comiler supplies all the necessary code. If we go by the example of anonymous class given by Manfred...in line 3, the anonymous class is created which extends Object and implements ActionListener. The compiler creates a class file for the anonymous class with the name... (supposing the name of the enclosing class is Outer) Outer$1.class.
please correct me if i am wrong,
kavita desai
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic