-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path27_Practice set on threads
More file actions
41 lines (40 loc) · 1001 Bytes
/
27_Practice set on threads
File metadata and controls
41 lines (40 loc) · 1001 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
package com.company;
class Threading extends Thread{
public void run(){
int i = 0;
while (i<123456){
System.out.println("Good Morning");
i++;
}
}
}
class Threading2 extends Thread{
public void run(){
// while (true){
// try {
// Thread.sleep(5000);
// }
// catch (Exception e){
// System.out.println(e);
// }
// System.out.println("Welcome");
// }
}
}
public class PracticeSet_threads {
public static void main(String[] args) {
Threading T = new Threading();
Threading2 TT = new Threading2();
// T.setPriority(6);
System.out.println(T.getPriority());
System.out.println(TT.getPriority());
// T.start();
try {
T.join();
} catch (Exception e) {
System.out.println(e);
}
TT.start();
System.out.println(TT.getState());
}
}