Getting wrong answer when trying in eclipse ide

I tried to compile it in java but im getting wrong answer…
public boolean cyclic(T src)
{
Queue q=new LinkedList<>();
Map<T,T> parent=new HashMap<>();
Set vis=new HashSet<>();
q.add(src);
vis.add(src);
parent.put(src,src);
while(!q.isEmpty())
{
T node=q.remove();
Iterator i=h.get(node).iterator();
while(i.hasNext())
{
T j=(T)i.next();
if(vis.contains(j) && !parent.get(j).equals(node))
{
return true;
}
else if(!vis.contains(j))
{
parent.put(j,node);
vis.add(j);
q.add(j);
}
}
}
return false;
}
public static void main(String args[])
{
graph_generictype s=new graph_generictype<>();
s.addedge(1, 0, true);
s.addedge(1, 2, true);
s.addedge(2, 4, true);
s.addedge(2, 3, true);
s.addedge(5, 3, true);
System.out.println(s.cyclic(0));
}

output : true

@demadachetan Please try running the code in codingblocks ide. If you are facing any problems in ecclipse

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.