publicclassB{publicstaticStringname="BB";static{System.out.println("before B init");try{TimeUnit.SECONDS.sleep(2);}catch(InterruptedExceptione){e.printStackTrace();}System.out.println("after B timeout");Stringn=C.name;System.out.println("after B init");}}
123456789101112131415161718
publicclassC{publicstaticStringname="CC";static{System.out.println("before C init");try{TimeUnit.SECONDS.sleep(2);}catch(InterruptedExceptione){e.printStackTrace();}System.out.println("after C timeout");Stringn=B.name;System.out.println("after C init");}}