class myThread extends Thread
{
    myThread() {  }
    myThread(String threadName) 
    {
        super(threadName); // Initialize thread.
        System.out.println(this);
        // start();
    }
    public void run() 
    { 
 	    while (true)
	    {
		    try { Thread.sleep(3000); } 
		    catch (InterruptedException ex) 
		    { 	System.out.println("We got problems");
        		System.out.println(Thread.currentThread().getName());
		    }
            System.out.println(Thread.currentThread().getName()+ " Running");
	    } 
    }
}

public class ex1 {
    public static void main(String[] args) 
    {
        Thread thread1 = new Thread(new myThread(), "myThread1");
        Thread thread2 = new myThread("myThread2");
        Thread thread3 = new myThread();
        //Start the threads
        thread1.start();
        thread2.start();
        thread3.start();
        try { Thread.currentThread().sleep(5 * 1000); } 
        catch (InterruptedException e) { }
        System.out.println(Thread.currentThread());
    }
}

