Skip to content

Commit df40b8f

Browse files
committed
Final Recorded Day
1 parent 0f121aa commit df40b8f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Threads/MyRunnable.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
public class MyRunnable implements Runnable{
2+
3+
@Override
4+
public void run() {
5+
for(int i = 0; i < 5; i ++) {
6+
7+
try{
8+
Thread.sleep(1000);
9+
} catch (InterruptedException e) {
10+
System.out.println("Thread was interrupted.");
11+
}
12+
13+
if(i == 4) {
14+
System.out.println("Time's up!");
15+
System.exit(0);
16+
}
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)