1. What will be the output of the program? public class Test107 implements Runnable { private int x; private int y; public static void main(String args[]) { Test107 that = new Test107(); (new Thread(that)).start(); (new Thread(that)).start(); } public synchronized void run() { for(int i = 0; i < 10; i++) { x++; y++; System.out.println("x = " + x + ", y = " + y); / Line 17 / } } }





Write Comment

Type in
(Press Ctrl+g to toggle between English and the chosen language)

Comments

Tags
Show Similar Question And Answers
QA->A computer with a 32 bit wide data bus implements its memory using 8 K x 8 static RAM chips. The smallest memory that this computer can have is:....
QA->There are 50 students in a class. In a class test 22 students get 25 marks each, 18 students get 30 marks each. Each of the remaining gets 16 marks. The average mark of the whole class is :....
QA->In a class of 20 students the average age is 16 years.If the age of the class teacher is added to that of students,the average age of the class becomes 17 years.What is the age of the teacher?....
QA->A program Graph has ‘start’ and ‘end’ nodes. The total number of paths from start to end is equivalent to the -----------set of test data required to test the software.....
QA->Twice World Cup Football winners Argentina sacked their coach on April 10, 2017 after a string of poor results. ? Name that coach?....
MCQ->What will be the output of the program? public class Test107 implements Runnable { private int x; private int y; public static void main(String args[]) { Test107 that = new Test107(); (new Thread(that)).start(); (new Thread(that)).start(); } public synchronized void run() { for(int i = 0; i < 10; i++) { x++; y++; System.out.println("x = " + x + ", y = " + y); / Line 17 / } } }....
MCQ->What will be the output of the program? class Happy extends Thread { final StringBuffer sb1 = new StringBuffer(); final StringBuffer sb2 = new StringBuffer(); public static void main(String args[]) { final Happy h = new Happy(); new Thread() { public void run() { synchronized(this) { h.sb1.append("A"); h.sb2.append("B"); System.out.println(h.sb1); System.out.println(h.sb2); } } }.start(); new Thread() { public void run() { synchronized(this) { h.sb1.append("D"); h.sb2.append("C"); System.out.println(h.sb2); System.out.println(h.sb1); } } }.start(); } }....
MCQ->What will be the output of the program? public class Q126 implements Runnable { private int x; private int y; public static void main(String [] args) { Q126 that = new Q126(); (new Thread(that)).start( ); / Line 8 / (new Thread(that)).start( ); / Line 9 / } public synchronized void run( ) / Line 11 / { for (;;) / Line 13 / { x++; y++; System.out.println("x = " + x + "y = " + y); } } }....
MCQ->What will be the output of the program? class MyThread extends Thread { MyThread() {} MyThread(Runnable r) {super(r); } public void run() { System.out.print("Inside Thread "); } } class MyRunnable implements Runnable { public void run() { System.out.print(" Inside Runnable"); } } class Test { public static void main(String[] args) { new MyThread().start(); new MyThread(new MyRunnable()).start(); } }....
MCQ->What will be the output of the program? class s implements Runnable { int x, y; public void run() { for(int i = 0; i < 1000; i++) synchronized(this) { x = 12; y = 12; } System.out.print(x + " " + y + " "); } public static void main(String args[]) { s run = new s(); Thread t1 = new Thread(run); Thread t2 = new Thread(run); t1.start(); t2.start(); } }....
Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use
DMCA.com Protection Status Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions