Create Runnable Class
public class MyRunnable implements Runnable {
@Override
public void run() {
System.out.println("Creating thread with Runnable: Thread is running...");
}
}
public class Main {
public static void main(String[] args) {
MyRunnable myRunnable = new MyRunnable();
Thread myThread = new Thread(myRunnable);
myThread.start();
System.out.println("Thread is started.");
}
}