Create Thread using Runnable interface | Core Java Tutorials

This “Create Thread using Runnable interface” page is providing clear information about how to create a user thread by implementing from Runnable interface in java application.

core-java-online-training-3

Creating Thread using Runnable interface:

  • When a class is implementing Runnable interface, it has to implement all the specifications of Runnable.
  • public void run() is the only specification in Runnable interface….
  • Runnable Object cannot be started directly. It is not the Thread.
  • Hence, it is mandatory to create Thread Object using Runnable Object.
  • Following method is used to create Thread using Runnable object.
    • public Thread(Runnable target)

Runnable Thread



 

Program to set the Identity of Thread that has created using Runnable

  • public Thread(Runnable target , String name)

core-java-online-training-3

Share this