Java Programming - Threads - Discussion

Discussion Forum : Threads - General Questions (Q.No. 4)
4.
class X implements Runnable 
{ 
    public static void main(String args[]) 
    {
        /* Missing code? */
    } 
    public void run() {} 
}
Which of the following line of code is suitable to start a thread ?
Thread t = new Thread(X);
Thread t = new Thread(X); t.start();
X run = new X(); Thread t = new Thread(run); t.start();
Thread t = new Thread(); x.run();
Answer: Option
Explanation:

Option C is suitable to start a thread.

Discussion:
15 comments Page 2 of 2.

Kaushiki singh said:   1 decade ago
I m also in doubt with this answer I think B option should be the right answer. Can you please give the explaination for this answer.

Gopichand said:   1 decade ago
I got confused, how it's work please explain it detail.

Sri rajyalakshmi said:   1 decade ago
Actually I am also confused thanks for clearing this.

Rayon said:   9 years ago
You are correct @Sundar. Agree with you.

Tulcram said:   1 decade ago
What does the X stands..?


Post your comments here:

Your comments will be displayed after verification.