JAVA Threads Which keyword when applied on a method indicates that only one thread should execute the method at a time. final volatile native static synchronized final volatile native static synchronized ANSWER DOWNLOAD EXAMIANS APP
JAVA Threads Analyze the following code:public class Test implements Runnable{ public static void main(String[] args){ Test t = new Test(); t.start(); } public void run() { }} The program does not compile because the start() method is not defined in the Test class. The program compiles, but it does not run because the start() method is not defined. The program compiles and runs fine. The program compiles, but it does not run because the run() method is not implemented. The program does not compile because the start() method is not defined in the Test class. The program compiles, but it does not run because the start() method is not defined. The program compiles and runs fine. The program compiles, but it does not run because the run() method is not implemented. ANSWER DOWNLOAD EXAMIANS APP
JAVA Threads What notifyAll() method do? Wakes up all threads that are waiting on this object's monitor Wakes up all threads that are not waiting on this object's monitor None of these Wakes up one threads that are waiting on this object's monitor Wakes up all threads that are waiting on this object's monitor Wakes up all threads that are not waiting on this object's monitor None of these Wakes up one threads that are waiting on this object's monitor 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"); }} "BeginEnd" is printed. An exception is thrown at runtime. "BeginRunEnd" is printed. Compilation fails. "BeginEndRun" is printed. "BeginEnd" is printed. An exception is thrown at runtime. "BeginRunEnd" is printed. Compilation fails. "BeginEndRun" is printed. ANSWER DOWNLOAD EXAMIANS APP
JAVA Threads In java a thread can be created by .......... Extending the thread class. Both of the above None of these Implementing Runnable interface. Extending the thread class. Both of the above None of these Implementing Runnable interface. ANSWER DOWNLOAD EXAMIANS APP
JAVA Threads Predict the output:public class Test extends Thread{ private int i; public void run(){ i++; } public static void main(String[] args){ Test a = new Test(); a.run(); System.out.print(a.i); a.start(); System.out.print(a.i); }} Prints Prints Compiler error Prints IllegalThreadStateException is thrown Prints Prints Compiler error Prints IllegalThreadStateException is thrown ANSWER DOWNLOAD EXAMIANS APP