Linkedlist circular linkedlist

why it give wrong answer???
import java.util.*;
public class LinkedList {

public class Node 
{
  int data;
  Node next;

 public Node(int data)
    {
	  this.data=data;
	} 
}
private int size;
private Node head;
private Node tail;

public  void add(int d)
   {
      Node nn=new Node(d);
	
	  if(head==null)
	     {
			 head=nn;
			 tail=nn;
		 }
		
		else
		{
		  tail.next=nn;
		  tail=nn;
		}   
   }
  public  void display()
      {
		  Node temp=head;
		  while(temp!=null)
		     {
				 System.out.print(temp.data+" ");
				 temp=temp.next;
			 }		    
	  }		
  public  void dloop()
      {
        Node slow=this.head;
		Node fast=this.head;

		while(fast!=null && fast.next!=null)
		   {
              slow=slow.next;
			  fast=fast.next.next;

			  if(slow==fast)
			     break;
		   }
		      
         if(slow==fast)
		    {
               Node start=head;
			   Node loop=slow;

			   while(start.next!=loop.next)
			      {
                     start=start.next;
					 loop=loop.next;
				  }

				 loop.next=null; 
			}
	  }		
    
public static void main(String args[]) {
     
    Scanner kb=new Scanner(System.in);
	LinkedList list=new LinkedList();
	int a=kb.nextInt();

        while(a!=-1)
		    {
			   list.add(a);
			   a=kb.nextInt();
			}

     
     list.dloop();	
	 list.display();		
    }

}

the way you are creating the linked list, this list can never have a loop. see, for every new integer you read, you are creating a new node, which makes it a simple linked list not circular.
say for eg. 2 3 4 5 6 7 5 -1, here even if you read 5 two times, you are creating two different nodes for same data 5.
Hint: you can detect the loop while reading the data. the approach you followed is helpful when a pre-built linked list is given to you as input.

Thanks