Why does this method throw an IllegalMonitorStateException?

Posted by kunjaan on Stack Overflow See other posts from Stack Overflow or by kunjaan
Published on 2010-05-06T04:34:54Z Indexed on 2010/05/06 4:38 UTC
Read the original article Hit count: 230

  public static synchronized void main(String[] args) throws InterruptedException {
    Thread t = new Thread();
    t.start();
    System.out.print("X");
    t.wait(10000);
    System.out.print("Y");
  }
  • What is the problem with this method?
  • How can I avoid such problems from now on?

© Stack Overflow or respective owner

Related posts about java

Related posts about concurrency