else
{
for (int i = 1;i>0;i--)
{
top = top.getLink();
top.setLink(top2);
}
return true;
}
for
loop will only run once. you initialize i
to 1, then decrement but only run the loop while i > 0
meaning after the first loop i
becomes zero so it doesn't run again.