Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need clarification in basics

 
dinesh Venkatesan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

This should be a very basic thing but i am left with no clues. Sorry if i am wrong.
I have seen a code snippet in an example


Could anybody explain the above mentioned snippet. How could a method be defined inside another method.

Thanks in advance.
regards,
dinesh.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the syntax for an anonymous class (although it's missing a semicolon at the end).

The block of code following the call "new Thread()" is the body of an anonymous class that extends Thread. In this example, the anonymous class is used to override Thread's run method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic