-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweek11a.java
More file actions
46 lines (46 loc) · 1.25 KB
/
week11a.java
File metadata and controls
46 lines (46 loc) · 1.25 KB
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
39
40
41
42
43
44
45
46
public class week11a {
public static void main(String[] args) {
First f=new First();
Second s=new Second();
Third t=new Third();
f.start();
s.start();
t.start();
}
static class First extends Thread{
public void run(){
for(int i=1;i<=10;i++){
System.out.println("Good Morning");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
static class Second extends Thread{
public void run(){
for(int i=1;i<=10;i++){
System.out.println("Hello");
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
static class Third extends Thread{
public void run(){
for(int i=1;i<=10;i++){
System.out.println("Welcome");
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}