-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJoinTest.java
More file actions
45 lines (40 loc) · 733 Bytes
/
Copy pathJoinTest.java
File metadata and controls
45 lines (40 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package bpok;
class JoinTest
{
public static void main(String[] args)
{
MyRunner r = new MyRunner();
//MyThread thread = new MyThread("guohao");
//thread.setName("guohao");
Thread thread = new Thread(r);
thread.start();
try{
thread.join();}
catch(InterruptedException ie){}
for(int i = 0;i<100;i++)
{
System.out.println("i am main");
}
}
}
//class MyThread extends Thread
class MyRunner implements Runnable
{
/*public MyRunner(String s )
{
super(s);
}
*/
public void run()
{
for(int i = 0;i<100;i++){
//System.out.println("i am mythread " + getName());
System.out.println("im thr-------");
/*try{
sleep(100);
}
catch(InterruptedException ie){}
*/
}
}
}