Skip to content

Commit 5f5a8fa

Browse files
Threads in Java
1 parent dcccfc1 commit 5f5a8fa

File tree

5 files changed

+41
-0
lines changed

5 files changed

+41
-0
lines changed

TheadsINJava/bin/Threads/Demo.class

513 Bytes
Binary file not shown.
1.22 KB
Binary file not shown.

TheadsINJava/bin/module-info.class

151 Bytes
Binary file not shown.

TheadsINJava/src/Threads/Demo.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package Threads;
2+
3+
4+
class myclass extends Thread {
5+
6+
7+
public void run() {
8+
for(int i = 0; i <10; i++) {
9+
System.out.println(Thread.currentThread().getId() + "value = "+i);
10+
}
11+
try {
12+
Thread.sleep(100);
13+
} catch (InterruptedException e) {
14+
// TODO Auto-generated catch block
15+
e.printStackTrace();
16+
}
17+
}
18+
19+
}
20+
21+
22+
23+
public class Demo {
24+
25+
public static void main(String[] args) {
26+
myclass class1 = new myclass();
27+
class1.start();
28+
myclass class2 = new myclass();
29+
class2.start();
30+
31+
}
32+
33+
}

TheadsINJava/src/module-info.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
*
3+
*/
4+
/**
5+
*
6+
*/
7+
module TheadsINJava {
8+
}

0 commit comments

Comments
 (0)