Рpublic void run(){Р}Рpublic void workMethod(int id,int sletim){РSystem.out.println();РSystem.out.println("Process"+id+":: Start running!!!");РSystem.out.println();РDate date1 = new Date();РSystem.out.println("开始时间:"+(date1.toString()).substring( 10,20));Р/*?帮助调试线程的执行Р* try {Р* wait();Р}catch(Exception e){РSystem.out.println("Process"+processID+" 有异常:"+e.toString() );Р}Р*/Рint sleeptime =sletim;РSystem.out.println("sleep time"+sleeptime);Рfor(int i =0;i<20;i++){Рvariable=variable+i;Р}Рtry {Рsleep(sleeptime);Р//sleep(sleeptime);Р}catch(Exception e){РSystem.out.println(e.toString() );Р}РSystem.out.println("Process"+id+":: Finished!!!");РDate date2 = new Date();РSystem.out.println("结束时间:"+(date2.toString()).substring( 10,20));РSystem.out.println("执行后的公共变量是:"+variable);РSystem.out.println();Р}