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}