hi,
After executing this code it gives me output :
Ex-B Exception in
thread "main" java.lang.IllegalMonitorStateException: current
thread not owner
at java.lang.Object.notifyAll(Native Method)
at tA.main(tA.java:35)
can anybody please explain me why?
please correct my understanding explained below:
1- At commented // 1 main thread creates a new thread and makes it wait at the thread pool
2- At commented // 2
main thread sleeps for 100 milisecond .so, the new thread crated gets its turn and sleeps for 1000 milisec by executing doDelay(1000) inside run method
3-At commented // 3 (i.e after 100 milisecond ) the main thread calls interrupt(); , thus interrupting the sleeping thread .
so Ex-tA should come in output.
thanks in advance