public class Main { public static void main(String[] argv) throws Exception { Object o = new Object(); System.out.println(Thread.holdsLock(o)); synchronized (o) { System.out.println(Thread.holdsLock(o)); } } }