Home / MCQ Bank / Computer
Computer Threads Difficulty: Medium

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(); } }

Select the correct option to test your answer:

More Computer Questions

In data modeling, what is the term for a visual representation of the relationship between different entities in a database? New . . . . . . . . type enables Indexing and searching of date ranges, particularly multi-valued ones. Which of the following sorting algorithm has best case time complexity of O(n 2 )? What is the purpose of the Oozie Coordinator Dataset? The ........... function is used to read a single character from a file.