Monday, 13 February 2017

UnCheckedException : IllegalThreadStateException




public class IllegalThreadStateException extends Throwable {

    public static void main(String args[]) {
        Example1 X1 = new Example1();
        Thread.currentThread().setName("Main Thread");

        System.out.println(Thread.currentThread().getName());        X1.run();
    }
    static class Example1 implements Runnable {
        Thread t = new Thread(this,"Running Thread:");
        public void run(){
            t.start();            System.out.println("Running Thread:" + t);        }
    }

}

No comments:

Post a Comment