reentrantlock java

Solutions on MaxInterview for reentrantlock java by the best coders in the world

showing results for - "reentrantlock java"
Monica
06 Jan 2018
1import java.util.concurrent.locks.ReentrantLock;
2
3public class test{
4  public static void main(String[] args)
5  {
6    ReentrantLock r1 = new ReentrantLock();
7    
8    r1.lock();
9    System.out.println("Only one thread can write this at a time");
10    r1.unlock();
11  }
12}