package com.brianway.learning.java.multithread.synchronize.example13; /** * Created by Brian on 2016/4/13. */ public class OutClass { static class Inner { public void method1() { synchronized ("ε…Άδ»–ηš„ι”") { for (int i = 1; i <= 10; i++) { System.out.println(Thread.currentThread().getName() + " i=" + i); try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } } } public synchronized void method2() { for (int i = 11; i <= 20; i++) { System.out.println(Thread.currentThread().getName() + " i=" + i); try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } } } }