The following program prints 1 2 3 4 and I don't know how. As soon as i=3, doesn't this call an interrupt? Will the catch get entered? I don't understand the flow of this program. I even passed object gf to run, and then did a gf.start() to deliberately start a thread and got the exact same output result. How? Here's the program:
(edited by Cindy to format code) [This message has been edited by Cindy Glass (edited November 06, 2001).]
Every Java book I've read also states that you shouldn't call the run() method of a Runnable object, but instead call the start() method. It may not make a difference in the way this piece of code is running, but we don't want anybody to start any bad habits now, do we?