×

Loading...

jabber, let me try ...

Let me try to express my opnion on this program.

the output is OK when the second Thread.sleep(15000) waits longer time than the first one. If we change 15000 to a number less than 1000, there will have a problem while running. When the while(){} is not over and the System.out.println("I came here") begins, the mt is not null. And System.out.println("I am not null") will be excuted. After this, mt.start() will bring problem because mt has already started. The problem will be catched by system because of try{...}catch{...}. Then the e.printStackTrace() will be executed. The rest output of System.out.println("x = "+ x); is OK.
Report

Replies, comments and Discussions: