- 6 Assume The Following Method Is Properly Synchronized And Called From A Thread A On An Object Wait 2000 After Call 1 (25.51 KiB) Viewed 32 times
6. Assume the following method is properly synchronized and called from a thread A on an object : wait(2000): After call
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
6. Assume the following method is properly synchronized and called from a thread A on an object : wait(2000): After call
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);