File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Anonymous clases

 
Sigfred Zamo
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
David Weitzman
Ranch Hand
Posts: 1365
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic