- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultithreading4.java
More file actions
Latest commit
37 lines (31 loc) · 1023 Bytes
/
Copy pathmultithreading4.java
File metadata and controls
37 lines (31 loc) · 1023 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
//Thread priorities
//konsa thread kab run hoga . kisiko kitini priorities milegi
//
//Thread by constructor
classthr1extendsThread {
publicthr1(Stringname) { // new type of Thread;
super(name);
}
publicvoidrun() {
System.out.println("th is" + this.getName());
// while (true) {
// System.out.println("i am a thread");
// }
}
}
publicclassmultithreading4 {
publicstaticvoidmain(String[] args) {
thr1t1 = newthr1(" varad1");
thr1t2 = newthr1(" varad2");
thr1t3 = newthr1(" varad3");
thr1t4 = newthr1(" varad4");
thr1t5 = newthr1(" varad5 most imp"); /// is object ko hame pehle run karna hai
t5.setPriority(Thread.MAX_PRIORITY); // is ko use krke ham kisi nhi function ko priority de skte hai;;;
t1.setPriority(Thread.MIN_PRIORITY);
t1.start();
t2.start();
t3.start();
t4.start();
t5.start();
}
}