This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Need clarification in basics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need clarification in basics " Watch "Need clarification in basics " New topic
Author

Need clarification in basics

dinesh Venkatesan
Ranch Hand

Joined: Oct 12, 2006
Posts: 134
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

Joined: Aug 31, 2004
Posts: 11343

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.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
GeeCON Prague 2014
 
subject: Need clarification in basics