class RunnableThread implements Runnable 
{
    Thread runner;
    public RunnableThread() { }
    public RunnableThread(String threadName) 
    {
        runner = new Thread(this, threadName); 
        runner.start(); 
    }
    public void run() 
    {
        System.out.println(Thread.currentThread().getName());
    }
}

public class ex2 
{
    public static void main(String[] args) 
    {
        Thread thread1 = new Thread(new RunnableThread(), "thread1");
        Thread thread2 = new Thread(new RunnableThread(), "thread2");
        RunnableThread thread3 = new RunnableThread("thread3");
        //Start the threads
        thread1.start();
        thread2.start();
        try 
        {
            Thread.currentThread().sleep(1000);
        } catch (InterruptedException e) {  }
        //Display info about the main thread
        System.out.println(Thread.currentThread());
    }
}
