-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmess4ge.java
More file actions
41 lines (37 loc) · 1.09 KB
/
mess4ge.java
File metadata and controls
41 lines (37 loc) · 1.09 KB
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
class RunThread implements Runnable{
private Thread thread;
private String threadName;
RunThread(String name){
threadName = name;
System.out.println(threadName + " created");
}
public void run(){
System.out.println(threadName + " run");
try{
System.out.println(threadName + ": Adhit - 18284");
Thread.sleep(30);
} catch(InterruptedException e){
System.out.println(threadName + " interrupted");
}
System.out.println(threadName + " exiting");
}
public void start(){
System.out.println(threadName + " started");
if(thread == null){
thread = new Thread(this, threadName);
thread.start();
}
}
}
public class mess4ge{
public static void main(String args[]){
RunThread R1 = new RunThread("Thread_1");
RunThread R2 = new RunThread("Thread_2");
RunThread R3 = new RunThread("Thread_3");
RunThread R4 = new RunThread("Thread_4");
R1.start();
R2.start();
R3.start();
R4.start();
}
}