The most difficult Java interview question in history

Reprinted, please indicate the original source, thank you!

Feel fine to understand the following questions, inadvertently, ready to bring the analysis.

Topics are as follows:

Public class TestSync2 implements Runnable int {B = 100; synchronized void M1 (throws InterruptedException) {B = 1000; Thread.sleep (500); System.out.println (b= + b);} synchronized void M2 (throws InterruptedException) {Thread.sleep (250); b = 2000;} public static void main (String[] args) throws InterruptedException {TestSync2 TT = new (TestSync2); Thread t = new Thread (TT); (t.start); tt.m2 (); System.out.println ("main thread b=" + tt.b);} @Override public void (run) {try} {(M1); catch (InterruptedException E) {(e.printStackTrace);}}}

What is the output of the program?? We consider that, next analysis, and we exchange, discuss, welcome message area comments!!!


Individual public number

The most difficult Java interview question in history
ingenuity zero public number.Jpg