Problems with a recursive stack

Hello!

I?ve got problems with a recursive stack.

I?ve got a stack overflow error. Here

is my push method.

publicvoid push(Object o)

{

StackRekursiv stack =new StackRekursiv();

stack.top = top;

stack.rest = rest;

if(top==null && rest==null)

{

rest = stack.rest =new StackRekursiv();

top = stack.top = o;

}

else

{

push(rest.top);

rest = stack.rest = stack;

top = stack.top = o;

}

}

Thank you for your help!

[978 byte] By [GiertzschMarca] at [2007-9-29 17:25:04]
# 1
[url http://forum.java.sun.com/thread.jsp?forum=31&thread=467503]Cross-post[/url]. This is not considered [url http://pjt33.f2g.net/javafaq/posting.html]good etiquette[/url].
YATArchivista at 2007-7-15 16:17:24 > top of Java-index,Other Topics,Algorithms...