Create a Thread with Runnable in Java
This post will teach you how to implement a thread in three different ways, all of which rely on the Runnable interface. You will learn that using the Runnable interface is the most flexible way to create multi-threaded code in Java.
Implementing Runnable interface with a class The easiest way to create a Runnable to run in a thread. It to create a class that implements the Runnable interface. The Runnable interface only has a single method void run();, Because of this it is called a functional interface.