lr12 -> e1

This commit is contained in:
2026-04-11 16:12:36 +05:00
parent 8c963da142
commit 661d20744a
2 changed files with 29 additions and 0 deletions

0
lr11/placeholder Normal file
View File

29
lr12/e1.java Normal file
View File

@@ -0,0 +1,29 @@
package lr12;
import java.time.LocalTime;
public class e1 {
public static void main(String[] args) {
Runnable task = () -> {
long endTime = System.currentTimeMillis() + 10_000;
while (System.currentTimeMillis() < endTime) {
System.out.println(
Thread.currentThread().getName() + " : " + LocalTime.now());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
};
Thread t1 = new Thread(task, "Thread-1");
Thread t2 = new Thread(task, "Thread-2");
t1.start();
t2.start();
}
}