Thread by Implementing Runnable Interface

We can define a Thread by implementing Runnable interface.

public class RunnableClass implements Runnable{
    @Override
    public void run() {
        System.out.println("Runnable interface");
    }
}
  class RunnableExample{
    public static void main(String[] args) {
        RunnableClass object = new RunnableClass();
        Thread t = new Thread(object);
        t.start();
    }}
Thread by Implementing Runnable Interface

Similar Java Tutorials

Leave a Comment