Following is the simplest example of how deadlock occurs?. Following code will run forever since they are waiting for each other to release the lock.
public static void main(String[] args) {
// TODO Auto-generated method stub
final LinkedList<String> ll_1=new LinkedList<String>();
final LinkedList<String> ll_2=new LinkedList<String>();
public static void main(String[] args) {
// TODO Auto-generated method stub
final LinkedList<String> ll_1=new LinkedList<String>();
final LinkedList<String> ll_2=new LinkedList<String>();