Threads

Q1:
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 ?

A Thread t = new Thread(X);

B Thread t = new Thread(); x.run();

C X run = new X(); Thread t = new Thread(run); t.start();

D Thread t = new Thread(X); t.start();

ANS:A - Thread t = new Thread(X);

Option C is suitable to start a thread.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.