vor GPT
This commit is contained in:
@@ -1,8 +1,26 @@
|
||||
package UE21_290425_Bruecke;
|
||||
|
||||
public class Generator {
|
||||
public static void main(String[] args) {
|
||||
Guard guard = new Guard();
|
||||
public class Generator extends Thread {
|
||||
public static boolean RESUME = true;
|
||||
private static Guard guard = new Guard();
|
||||
private static Generator generator = new Generator();
|
||||
|
||||
public static void main(String[] args) {
|
||||
generator.start();
|
||||
guard.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (Generator.RESUME) {
|
||||
try {
|
||||
Thread.sleep((int) (Math.random() * 5 + 1) * 1000L);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Car car = new Car(guard);
|
||||
guard.arriving(car);
|
||||
System.out.println(guard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user