public class JoinThread extends Thread
{
public staticvolatileint n = 0;
public void run()
{
for (int i = 0; i < 10; i++)
try
{
n = n + 1;
sleep(3); // 为了使运转了局更随机,提早3毫秒
}
catch (Exception e)
{
}
}
public static void main(String[] args) throws Exception
{