It's not a secret anymore!*
The moose likes Beginning Java and the fly likes Anonymous clases Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Anonymous clases" Watch "Anonymous clases" New topic
Author

Anonymous clases

Sigfred Zamo
Ranch Hand

Joined: Mar 04, 2002
Posts: 44
I�m studying Sun�s Java tutorial.
At http://java.sun.com/docs/books/tutorial/java/javaOO/QandE/nested-questions.html, second question.
I simplified the question, I could arrive to this:

Could somebody explain to me this code snippet?
What is the meaning of t instance?
[ April 06, 2002: Message edited by: Cindy Glass ]

Sigfred Zamo<br />Software Development<p><a href="http://www.sigfredo.ingenieros.net/index2.html" target="_blank" rel="nofollow">My page</a>
David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
The Timer is smart enough to know that something is supposed to be done -- it just doesn't have a clue what. A TimerTask subclass, here an annoymous class, handles the actions. If you know about threads, this is similar to

The code Sun wrote could also be written like this:

[ April 06, 2002: Message edited by: Cindy Glass ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Anonymous clases