Menu
Topics Index
...
`

Digital Threads


If you need explanation Read this topic

If you need Answer Take test on this topic

Digital Threads
What will be the output of the following program?
public class Digital extends Thread {

    public void run() {
        System.out.println("Now you are here");
    }

    public static void main(String a[]) {
        Thread run = new Thread(new Digital());
        System.out.print("1. ");
        run.start();
        System.out.print("2. ");
        run.start();
    }
}

A. 1. Now you are here
2. Now you are here
B. 1. Now you are here
C. Compilation Error
D. Throws java.lang.IllegalThreadStateException
E. Runtime Error for some other reason
Topic: What is Multitasking and Multithreading?

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

option D is the answer siunce the source is not specified

Posted by Karteek Paruchuri    2013-04-18 12:28:20


source is not specified for the start method

Posted by Karteek Paruchuri    2013-04-18 12:28:58


Ans is D, because, you cannot call the same thread once you called, this leads to llegealThreadStateException.

Posted by Srihari Adelli    2013-04-18 12:34:53


It is D, coz, calling start at 13th line again will fail as it is already started..thus it throws a illegalThreadStateException :)

Posted by Shaik Nyamath    2013-04-18 12:39:59


Answer is obviously D,but the correct xplanation is by SHAIK.

Posted by Syed Farhath    2013-04-18 16:29:04


Congratulations Srihari Adelli. You are this daily dose's winner. Please send us your mobile details and we will process the recharge by tomorrow.

Posted by Merit Campus    2013-04-19 04:10:33


Thank you Merit Campus I have received the recharge

Posted by Srihari Adelli    2013-04-22 14:22:06


© meritcampus 2019

All Rights Reserved.

Open In App