forked from sPredictorX1708/Ultimate-Java-Resources
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriver.java
More file actions
30 lines (25 loc) · 637 Bytes
/
Driver.java
File metadata and controls
30 lines (25 loc) · 637 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
// Thread Implementation using Runnable (Runnable does not return any object)
public class Driver {
static final int MAX_T = 100;
public static void main(String abc[]) {
Runnable r2 = new Thread("Hello : ");
for (int i = 0; i < 1000000; i++) {
r2.run();
}
}
}
class Thread implements Runnable {
private String name;
String digest;
public Thread(String s) {
name = s;
}
public void run() {
try {
digest = "hello";
System.out.println(digest);
} catch (Exception e) {
e.printStackTrace();
}
}
}