added ex U
This commit is contained in:
22
src/exercises/ex_u/FamilyMember.java
Normal file
22
src/exercises/ex_u/FamilyMember.java
Normal file
@ -0,0 +1,22 @@
|
||||
package exercises.ex_u;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
public class FamilyMember implements Runnable {
|
||||
private final String name;
|
||||
private final Vehicle vehicle;
|
||||
private final CountDownLatch countDownLatch;
|
||||
|
||||
public FamilyMember(String name, Vehicle vehicle, CountDownLatch countDownLatch) {
|
||||
this.name = name;
|
||||
this.vehicle = vehicle;
|
||||
this.countDownLatch = countDownLatch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
vehicle.addSuitcase(name + "'s suitcase");
|
||||
System.out.println(name + " has loaded their suitcase");
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user