@@ -0,0 +1,267 @@
+package com.yutax77.java8_ans.chap3;%0A%0Aimport java.util.concurrent.locks.ReentrantLock;%0A%0Apublic class Ans2 %7B%0A    public static void withLock(ReentrantLock lock, Runnable runnable) %7B%0A%09lock.lock();%0A%09try %7B%0A%09    runnable.run();%0A%09%7D finally %7B%0A%09    lock.unlock();%0A%09%7D%0A    %7D%0A%7D%0A

Answer chap.3-2