This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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: 3223
It is creating an inner class and executing the run() method. Have a look at Java inner classes.


Java Interview Questions and Answers Blog | Amazon.com profile | Java Interview Books
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Runnable Issue