Java Program on MultiThreading by implementing Runnable Example 2

PROGRAM:

class MyThread implements Runnable {
    Thread ThreadOne;

    MyThread() {
        System.out.println("I'm Consturctor");
        ThreadOne = new Thread(this);
        ThreadOne.start();
    }

    public void run() {
        System.out.println("Thread is running");
    }
}

class RunnableDemo {
    public static void main(String[] args) {
        MyThread myt = new MyThread();
    }

OUTPUT:

I'm Consturctor
Thread is running

Popular Posts