Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Beginning Java and the fly likes Anonymous Classes doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Anonymous Classes doubt" Watch "Anonymous Classes doubt" New topic

Anonymous Classes doubt

Deepak Borania
Ranch Hand

Joined: Jul 28, 2009
Posts: 45
Can someone please elaborate on Anonymous classes and tell me what they are used for.I am using Horton's Beginning Java, which isn't clear on the subject.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42954
Maybe the "Nested Classes" chapter in the Sun Java tutorial does a better job:
Deepak Borania
Ranch Hand

Joined: Jul 28, 2009
Posts: 45
It just has one line on Anonymous classes, in which it says it's for advanced users.

Can someone please help me understand Anonymous Classes?
Nitish Bangera
Ranch Hand

Joined: Jul 15, 2009
Posts: 537

I guess if you reached annonymous classes then you may be knowing annonymous arrays. Its the same Like array we are creating a new array without a name. In annonymous classes we are creating classes without a name but not just any class but the a subclass which has no name. Annonymous classes can be used to subclass an abstract class and also implement an interface directly. Well all other concepts are same as subclasses as annonymous classes.

[ SCJP 6.0 - 90% ] , JSP, Servlets and Learning EJB.
Try out the programs using a TextEditor. Textpad - Java 6 api
Himanshu Kansal
Ranch Hand

Joined: Jul 05, 2009
Posts: 257
Explanations might be confusing, just visit this tutorial

Experience and talent are independent of age
Deepak Borania
Ranch Hand

Joined: Jul 28, 2009
Posts: 45
hmm.....starting to get the hang of it....thanks guys

Have you tried LearnNowOnline?
subject: Anonymous Classes doubt