-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThreadDemo4.java
More file actions
27 lines (25 loc) · 563 Bytes
/
ThreadDemo4.java
File metadata and controls
27 lines (25 loc) · 563 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
package java_Threads;
public class ThreadDemo4 {
public static void main(String[] args) {
TestThread4 t = new TestThread4();
t.start();
// t.start();
// t.start();
// t.start();
TestThread4 t1 = new TestThread4();
t1.start();
}
}
class TestThread4 extends Thread {
public void run() {
while (true) {
System.out.println(Thread.currentThread().getName() + " is running");
try {
Thread.sleep(1000); // 1000����
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}