forked from aryan1403/wipro-rps-training
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththex.java
32 lines (32 loc) · 949 Bytes
/
thex.java
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
public class thex {
public static void main(String[] args) {
Thread th = new Thread() {
@Override
public void run() {
for (int i = 0; i < 100; i++) {
try {
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(i);
}
}
};
Thread th2 = new Thread() {
@Override
public void run() {
for (int i = 0; i < 100; i++) {
System.out.println(i * -1);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
th.start();
th2.start();
}
}