wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
 
wood burning stoves
 
subject: Need clarification in basics
 
Similar Threads
volatile example
how to read config file when web service starts up
synchronized and ReentrantReadWriteLock
Difference B/w ArrayList & Vector
interceptors in the EJB 3.0 ejb-jar.xml