-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain_76.java
More file actions
38 lines (38 loc) · 898 Bytes
/
Main_76.java
File metadata and controls
38 lines (38 loc) · 898 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
class Prac1 extends Thread{
public void run(){
int i=0;
while(i<50){
try{
Thread.sleep(200);
}
catch(Exception e){
System.out.println(e);
}
System.out.println("good morning");
i++;
}
}
}
class Prac2 extends Thread{
public void run(){
int i=0;
while(i<50){
System.out.println("welcome");
i++;
}
}
}
public class Main_76 {
public static void main(String[] args) {
Prac1 p1=new Prac1();
Prac2 p2=new Prac2();
p1.setPriority(6);
p2.setPriority(9);
System.out.println(p1.getPriority());
System.out.println(p2.getPriority());
System.out.println(p1.getState());
p1.start();
p2.start();
System.out.println(p2.getState());
}
}