Java program on Multithreading by implementing Runnable Example 1

PROGRAM:

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

class RunnableDemo {
    public static void main(String[] args) {
        ThreadOne tone = new ThreadOne();
        Thread t = new Thread(tone);
        t.start();
        System.out.println("I'm main");
    }
}

OUTPUT:

I'm main
Thread is running

Popular Posts