title: Java exit() method hungs after loop creation in a linked list
body: <p>Trying to create loop within a linked list, program is as below. But once the method is done making the loop, java exit() thread gets called and it gets hung there. I dont understand what could be the issue here. </p>
  
  <pre><code>package Inter;
  
  import Inter.LinkedList.node;
  
  public class LinkedListLoops {
  
  
  
      public static void makeLoop(node nod)
      {
  
          node cur = nod;
          while(cur.next!=null)
              cur= cur.next;
          cur.next=nod.next;
  
      }
  
      public static void main(String argsp[])
      {
          LinkedList l1 = new LinkedList();
          l1.addNode(1);
          l1.addNode(2);
          l1.addNode(3);
          l1.addNode(4);
          l1.addNode(5);
          LinkedListLoops.makeLoop(l1.head);
      }
  
  }   
  </code></pre>