-
Notifications
You must be signed in to change notification settings - Fork 0
/
Multithreading.java
42 lines (42 loc) · 1.14 KB
/
Multithreading.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
class A extends Thread{
public void run(){
System.out.println("Entrance of Process A");
for(int i=1;i<=5;i++){
System.out.println("Process A : "+ i);
}
System.out.println("Existance of Process A");
}
}
class B extends Thread{
public void run(){
System.out.println("Entrance of Process B");
for(int i=1;i<=5;i++){
System.out.println("Process B : "+ i);
}
System.out.println("Existance of Process B");
}
}
class C extends Thread{
public void run(){
System.out.println("Entrance of Process C");
for(int i=1;i<=5;i++){
System.out.println("Process C : "+ i);
if(i==3){
try{
sleep(4000);
}
catch(Exception e){
System.out.println(e);
}
}
}
System.out.println("Existance of Process C");
}
}
public class Multithreading {
public static void main(String[] args) {
new A().start();
new B().start();
new C().start();
}
}