-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththread_multi1.java
More file actions
46 lines (43 loc) · 991 Bytes
/
thread_multi1.java
File metadata and controls
46 lines (43 loc) · 991 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
46
class thread1 extends Thread{
public void run()
{
try{
for(int i=0;i<20;i++)
{
System.out.println("thread1"+i);
sleep(1000);
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}
class runnable extends thread1 implements Runnable{
public void run()
{
try{
for(int i=0;i<20;i++)
{
System.out.println("RUNNABLE"+i);
sleep(1000);
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}
public class thread_multi1{
public static void main(String args[])
{
thread1 th1=new thread1();
// Thread th11 = new Thread(th1);
runnable th2 = new runnable();
//Thread th22 = new Thread(th2);
th1.start();
th2.start();
}
}