public class tester { public static void main(String[] args) throws Exception { test1 t = new test1(); t.start(); System.out.println("bbb"); t.notify(); } } class test1 extends Thread { public void run() { try{ while( true ) { synchronized (this) { System.out.println("a"); wait(1000); } } } catch (InterruptedException e) { System.out.println("c"); return; } } } ////////// OUTPUT: ////////////// Exception in thread "main" java.lang.IllegalMonitorStateException bbb a at java.lang.Object.notify(Native Method) at tester.main(tester.java:9) a a a a a a (Kept outputting 'a's until I manually interrupted it [from the keyboard, that is].)