The trick used here is called anonymous classes. Basically, you are creating a object of a new anonymous class that implements Runnable
.
The better example would be this:
Thread t = new Thread(new Runnable(){
@Override
public void run() {
// Code here
}
});