File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Runnable Issue" Watch "Runnable Issue" New topic
Author

Runnable Issue

awad saleh
Greenhorn

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() {
System.out.println("Hello!");
}
}).start();
}
}


Thank Q.
arulk pillai
Author
Ranch Hand

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


[Java-Success.com] | [Java job hunting know how] | [Java resumes]
 
jQuery in Action, 3rd edition
 
subject: Runnable Issue
 
It's not a secret anymore!