What will be the output?  public class DeadlockExample { sta…

What will be the output?  public class DeadlockExample { static final String resource1 = “Resource1”; static final String resource2 = “Resource2”; public static void main(String[] args) { Thread t1 = new Thread(() -> { synchronized (resource1) { System.out.println(“Thread 1 locked resource1”); try { Thread.sleep(50); } catch (Exception e) {} synchronized (resource2) { System.out.println(“Thread 1 locked resource2”); } } }); Thread t2 = new Thread(() -> { synchronized (resource2) { System.out.println(“Thread 2 locked resource2”); try { Thread.sleep(50); } catch (Exception e) {} synchronized (resource1) { System.out.println(“Thread 2 locked resource1”); } } }); t1.start(); t2.start(); } }