-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdemo4.java
More file actions
40 lines (35 loc) · 838 Bytes
/
demo4.java
File metadata and controls
40 lines (35 loc) · 838 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
/**
*
*/
package extendsthread;
/**
* @author M.NAVEEN
RANDOM CODER'S
*
*/
public class demo4 extends Thread
{
public demo4()
{
}
public void run()
{
for(int i=0;i<20;i++)
System.out.println(Thread.currentThread().getName());
System.out.println(Thread.currentThread().getPriority());
}
public static void main(String[] args)
{
demo4 t1=new demo4(); t1.setName("Thread 1");
t1.start();
demo4 t2=new demo4(); t2.setName("Thread 2");
t2.start();
demo4 t3=new demo4(); t3.setName("Thread 3");
t3.start();
demo4 t4=new demo4(); t4.setName("Thread 4");
demo4 t5=new demo4(); t5.setName(" 5th thread");
for(int i=0;i<20;i++)
System.out.println(Thread.currentThread().getName());
System.out.println(t5);
}
}