File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Runnable Issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Runnable Issue" Watch "Runnable Issue" New topic

Runnable Issue

awad saleh

Joined: Jul 04, 2007
Posts: 22
Hello everyone..

As we know we create an object of interface. Then why the below program is getting executed..?
I need an explanation how it is getting executed.....?

public class Test {
public static void main(String[] args) {
new Thread(new Runnable() {
public void run() {

Thank Q.
arulk pillai
Ranch Hand

Joined: May 31, 2007
Posts: 3371
It is creating an inner class and executing the run() method. Have a look at Java inner classes.

[] | [Java job hunting know how] | [Java resumes]
I agree. Here's the link:
subject: Runnable Issue
It's not a secret anymore!