Menu
Topics Index
...
`

Display Output2547


If you need explanation Read this topic

If you need Answer Take test on this topic

Display Output2547
What will be the output of the following program?
class T implements Runnable {
    public void run() {
        System.out.print("Output Display~");
    }
}
public class TClass {
    public static void main(String args[]) throws Exception {
        Thread thread1 = new Thread();
        Thread thread2 = new Thread(new T());
        Thread thread3 = new Thread(new T(), "Thread3");
        Thread thread4 = new Thread("Thread4");
        thread1.run();    thread2.run();
        thread3.run();    thread4.run();
    }
}

A. Output Display~Output Display~
B. Output Display~Output Display~Output Display~
C. Output Display~Output Display~Output Display~Output Display~
D. Some other output
E. Compilation Error or Runtime Error
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.

Answer is A,
For thread2, thread3 run method executes and prints "Output Display~" where as thread1 and 4 there is no link between class T and TCClass.

Posted by Amar Kumar Biradar    2014-02-04 08:24:48


Congratulations Amar Kumar Biradar. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-02-05 04:18:14


© meritcampus 2019

All Rights Reserved.

Open In App