Click here to watch in Youtube :
https://www.youtube.com/watch?v=ZRnsX4yLHiE&list=PLmCsXDGbJHdh64JikgqsIpVoKSsKAxmxq
See also:
|  | 
| Java Tutorial : Java Threads (How to create a thread in java | Runnable interface in java) | 
|  | 
| Java Tutorial : Java Threads (How to create a thread in java | Runnable interface in java) | 
/* * If you are not extending the Thread class,your class * object would not be treated as a thread object.So you * need to explicitly create Thread class object.We are * passing the object of your class that implements * Runnable so that your class run() method may execute. */ public class DisplayRunnable implements Runnable { public static void main(String args[]) { DisplayRunnable displayRunnable = new DisplayRunnable(); Thread thread = new Thread(displayRunnable); thread.start(); } /* * When an object implementing interface Runnable is * used to create a thread, starting the thread causes * the object's run method to be called in that * separately executing thread. */ @Override public void run() { System.out.println("Hello Peter.."); } }Output
Hello Peter..
Refer: 
https://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html
Click the below link to download the code:|  | 
| Java Tutorial : Java Threads (How to create a thread in java | Thread creation in java) | 
|  | 
| Java Tutorial : Java Threads (How to create a thread in java | Thread creation in java) | 
class DisplayThread extends Thread { public static void main(String args[]) { /* * Allocates a new Thread object. */ DisplayThread displayThread = new DisplayThread(); /* * Causes this thread to begin execution; the Java * Virtual Machine calls the run method of this * thread */ displayThread.start(); } /* * Subclasses of Thread should override run() method. */ @Override public void run() { System.out.println("Welcome to india"); } }Output
Welcome to indiaRefer:
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V6) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V6) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V6) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V5) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V5) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V5) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V4) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V4) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V4) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V3) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V3) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V3) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V3) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V3) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V2) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V2) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V2) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V2) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V2) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V2) | 
|  | 
| Java Tutorial : Java Threads (Life cycle of a Thread in Java | Java thread life cycle_V1) | 
|  | 
| Java Tutorial : Java Threads (Java Threading and multitasking - Real time example) | 
|  | 
| Java Tutorial : Java Threads (Java Threading and multitasking - Real time example) | 
|  | 
| Java Tutorial : Java Threads (Java Threading and multitasking - Real time example) | 
|  | 
| Java Tutorial : Java Threads (Java Threading and multitasking) | 
|  | 
| Java Tutorial : Java Threads (Java Threading and multitasking) | 
|  | 
| Java Tutorial : Java Threads (Java processes and threads with example) | 
|  | 
| Java Tutorial : Java Threads (Java processes and threads) | 
|  | 
| Java Tutorial : Java Threads (Java processes and threads) |