Home / MCQ Bank / Computer
Computer Threads

Which of these keywords are used to implement synchronization? class newthread extends Thread { Thread t; String name; newthread(String threadname) { name = threadname; t = new Thread(this,name); t.start(); } public void run() { } } class multithreaded_programing { public static void main(String args[]) { newthread obj1 = new newthread("one"); newthread obj2 = new newthread("two"); try { obj1.t.wait(); System.out.print(obj1.t.isAlive()); } catch(Exception e) { System.out.print("Main thread interrupted"); } } }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option D • synchronized

Related Computer Questions

The blobs are generally stored in Which of the following property sets a consistent margin on all four sides of the affected element? In R, which package provides functions for working with large spatial datasets and spatial statistics? What will be the output of the following C# code snippet? class B { } class A : B { } class Program { static void Main(string[] args) { A a = new A(); B b = new B(); if (a is A) Console.WriteLine("a is an A"); if (b is A) Console.WriteLine("b is an A because it is derived from A"); if (a is B) Console.WriteLine("This won't display -- a not derived from B"); Console.ReadLine(); } } Which of the following is not a namespace in the .NET Framework Class Library?