package 线程;
public class JoinDome extends Thread {@Override
public void run() {
int sum=0;
for(int i=0;i<=100;i++){
if(i%2==0){
sum=i+sum;
}
}
System.out.println(Thread.currentThread().getName()+"\t"+sum);
}
}
public class JoinTest {
public static void main(String[] args) {
int i;
for(i=0;i<7;i++){
if(i==3){
JoinDome jd=new JoinDome();
jd.setName("线程1");
jd.start();
try {
jd.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}System.out.println(Thread.currentThread().getName()+"\t"+i);
}
}
}