JAVA Threads
Which of the following constructor of class Thread is valid one?

Thread(Runnable threadOb, int priority)
None of these
Thread(String threadName, int priority)
Thread(int priority)
Thread(Runnable threadOb, String threadName)

ANSWER DOWNLOAD EXAMIANS APP

JAVA Threads
Predict the output:class A implements Runnable{ public void run(){ try{ for(int i=0;i<4;i++){ Thread.sleep(100); System.out.println(Thread.currentThread().getName()); } }catch(InterruptedException e){ } }}public class Test{ public static void main(String argv[]) throws Exception{ A a = new A(); Thread t = new Thread(a, "A"); Thread t1 = new Thread(a, "B"); t.start(); t.join(); t1.start(); }}

Output order is not guaranteed
A B A B A B A B
A A A A B B B B
Compilation succeed but Runtime Exception
None of these

ANSWER DOWNLOAD EXAMIANS APP

JAVA Threads
Given the code. What will be the result?public class Test implements Runnable{ public static void main(String[] args) throws InterruptedException{ Thread a = new Thread(new Test()); a.start(); System.out.print("Begin"); a.join(); System.out.print("End"); } public void run(){ System.out.print("Run"); }}

"BeginRunEnd" is printed.
"BeginEnd" is printed.
Compilation fails.
"BeginEndRun" is printed.
An exception is thrown at runtime.

ANSWER DOWNLOAD EXAMIANS APP

JAVA Threads
Analyze the following code:public abstract class Test implements Runnable{ public void doSomething() { };}

The program will not compile because it does not implement the run() method.
The program compiles fine.
None of these
The program will not compile because it does not contain abstract methods.

ANSWER DOWNLOAD EXAMIANS APP

JAVA Threads
What notifyAll() method do?

Wakes up all threads that are waiting on this object's monitor
Wakes up one threads that are waiting on this object's monitor
None of these
Wakes up all threads that are not waiting on this object's monitor

ANSWER DOWNLOAD EXAMIANS APP