-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiThreading4.java
More file actions
41 lines (34 loc) · 894 Bytes
/
MultiThreading4.java
File metadata and controls
41 lines (34 loc) · 894 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
/**
* Created by Admin on 14-04-2017.
*/
public class MultiThreading4 {
static int threadsRunning=0;
public static void startKarThread(){
Thread t=new Thread(new Runnable() {
@Override
public void run() {
MultiThreading4.runWaalaMethod();
}
});
t.start();
}
public static void runWaalaMethod(){
for(int i=0;i>-1;i++){
try{
Thread.sleep(10);
}catch (Exception e){
}
}
}
public static void main(String[] args){
for(int i=0;i<3000;i++){
threadsRunning++;
startKarThread();
System.out.println("Threads running - "+threadsRunning);
}
try{
Thread.sleep(100000);
}catch (Exception e){
}
}
}