Skip to content

Commit eec5539

Browse files
authored
Create Multithreading.java
pls review it and merge it
1 parent 35b3144 commit eec5539

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Multithreading.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class MyThread extends Thread {
2+
public void run() {
3+
for (int i = 1; i <= 5; i++) {
4+
System.out.println("Thread " + Thread.currentThread().getId() + " - Count " + i);
5+
}
6+
}
7+
}
8+
9+
public class MultiThreadDemo {
10+
public static void main(String[] args) {
11+
MyThread thread1 = new MyThread();
12+
MyThread thread2 = new MyThread();
13+
14+
thread1.start();
15+
thread2.start();
16+
}
17+
}

0 commit comments

Comments
 (0)