- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunnable_Ex.java
More file actions
Latest commit
31 lines (28 loc) · 692 Bytes
/
Copy pathRunnable_Ex.java
File metadata and controls
31 lines (28 loc) · 692 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
classRunnable1implementsRunnable{
publicvoidrun(){
inti = 0;
while(true){
System.out.println("I am a thread 1 not a threat 1");
i++;
}
}
}
classRunnable2implementsRunnable{
publicvoidrun(){
inti = 0;
while(true){
System.out.println("I am a thread 2 not a threat 2" );
i++;
}
}
}
publicclassRunnable_Ex {
publicstaticvoidmain(String[] args) {
Runnable1bullet1 = newRunnable1();
Threadgun1 = newThread(bullet1);
Runnable2bullet2 = newRunnable2();
Threadgun2 = newThread(bullet2);
gun1.start();
gun2.start();
}
}