-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoop28.java
47 lines (36 loc) · 941 Bytes
/
oop28.java
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
47
class thr1 extends Thread{
public void run(){
int i=0;
while(i<100){
System.out.println("Good Morning !!");
i++;
}
}
}
class thr2 extends Thread{
public void run(){
int i=0;
while(i<100){
System.out.println("Welcome");
try {
Thread.sleep(200);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
i++;
}
}
}
public class oop28 {
public static void main(String[] args) {
thr1 thr1= new thr1();
thr2 thr2= new thr2();
thr1.start();
thr1.setPriority(2);
thr2.start();
thr2.setPriority(3);
System.out.println("t1 piority is"+thr1.getPriority());
System.out.println("t2 piority is"+thr2.getPriority());
}
}