vor GPT
This commit is contained in:
@@ -1,5 +1,25 @@
|
||||
package UE21_290425_Bruecke;
|
||||
|
||||
public class Car {
|
||||
import java.time.LocalTime;
|
||||
|
||||
public class Car extends Thread {
|
||||
private static final int crossingTime = 50_000;
|
||||
LocalTime arrivingTime;
|
||||
Guard guard;
|
||||
|
||||
public Car(Guard guard) {
|
||||
this.guard = guard;
|
||||
this.arrivingTime = LocalTime.now();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(crossingTime);
|
||||
guard.leaving();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user