6. Assume the following method is properly synchronized and called from a thread A on an object : wait(2000): After call
Posted: Fri May 20, 2022 1:30 pm
6. Assume the following method is properly synchronized and called from a thread A on an object : wait(2000): After calling this method, when will the thread A become a candidate to get another turn at the CPU? 7. Which of the following methods make a thread leave the running state? 1. yield il wait) til notify iv. notifyAllo v. sleep(1000) vi. Thread.join() vii. Thread kill Threado 8. What is the output of the following code? public class ThreadDemo extends Thread private int x=0; private int y=0; public static void main(String (I args) ThreadDemo obj = new ThreadDemol): (new Thread(obj).start(): obj.start(): ) public synchronized void run 0 for (int i=0;13, 1++) X; Y++; System.out.println("x=" +x+"y"+y);