Depending on your operating system (coughWindowscough) output from System.out.print() called right before a program exits may not appear on the console. Either use println() for the second call, or call System.out.flush() after the second print(). Otherwise, your code should work as expected.
Hi I complied and ran this code but replaced the line wait(5000) with wait() The program didn't stop executing. My question is : Is notify/notifyAll the only way for the thread to stop waiting? Thanks, Lalitha
Hello Lalitha, Only other method I can think of is interrup()
Joined: Jul 03, 2003
Thanks Barkat... Could you please refer to some resources for threads. I don't feel very comfortable with them. Thank you, Lalitha
Joined: Aug 05, 2002
I would start with thread tutorial at sun site. Follow that up with any books that you are reading. K & B is good but very limited for threads. I also read Ivor Horton's Begining Java 2 and some other books. Refer to JSL and API as much as possible. Biggest help is practice. Barkat