forked from arnav-srivastava/Java_Basics_Advanced
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmulti.java
More file actions
38 lines (34 loc) · 945 Bytes
/
multi.java
File metadata and controls
38 lines (34 loc) · 945 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
31
32
33
34
35
36
37
38
class thread1 implements Runnable {
public void run() {
try {
for (int i = 1; i <= 15; i++) {
System.out.println("Shobhit............" + i);
Thread.sleep(1000);
}
} catch (Exception e) {
System.out.println(e);
}
}
}
class thread2 implements Runnable {
public void run() {
try {
for (int j = 70; j <= 90; j = j + 2) {
System.out.println(j + "............Devesh");
Thread.sleep(500);
}
} catch (Exception e) {
System.out.println(e);
}
}
}
public class multi {
public static void main(String[] args) {
thread1 th1 = new thread1();
Thread th11 = new Thread(th1);
thread2 th2 = new thread2();
Thread th22 = new Thread(th2);
th11.start();
th22.start();
}
}