-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIMR2.java
More file actions
45 lines (44 loc) · 982 Bytes
/
IMR2.java
File metadata and controls
45 lines (44 loc) · 982 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
39
40
41
42
43
44
45
public class IMR2
{
public static void main(String[] args)
{
Thread r1=new Thread(new Runnable()
{
public void run()
{
for(int i=0;i<10;i++)
{
System.out.println("Hello "+i*10);
try
{
Thread.sleep(100);
}
catch(InterruptedException e)
{
e.printStackTrace();
}
}
}
});
Thread r2=new Thread(new Runnable()
{
public void run()
{
for(int i=0;i<10;i++)
{
System.out.println("Hello "+i);
try
{
Thread.sleep(100);
}
catch(InterruptedException e)
{
e.printStackTrace();
}
}
}
});
r1.start();
r2.start();
}
}